Snapshot of main at 9f39a6e1e (2026-11-02)

This commit is contained in:
Ronald Huynen committed 2026-11-02 10:41:47 +01:00
commit 6ccf1792d7
2580 files changed
+1040202

No files matched your search

@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands;
use App\Models\Post;
use Illuminate\Console\Command;
class RegisterPostsAsReactants extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'posts:register-reactants';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Register all existing posts as Love reactants';
/**
* Execute the console command.
*/
public function handle()
{
$this->info('Registering posts as Love reactants...');
$posts = Post::all();
$registered = 0;
$skipped = 0;
foreach ($posts as $post) {
if (!$post->isRegisteredAsLoveReactant()) {
$post->registerAsLoveReactant();
$registered++;
} else {
$skipped++;
}
}
$this->info("Registered {$registered} posts as reactants.");
$this->info("Skipped {$skipped} posts (already registered).");
$this->info('Done!');
return Command::SUCCESS;
}
}