A lot of things

This commit is contained in:
2026-06-16 16:21:43 +02:00
parent 4f9f6c63b3
commit 7e1e26f20b
126 changed files with 7917 additions and 204 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Models\Entry;
use App\Models\News;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
@@ -20,7 +21,11 @@ class DeleteRejectedEntries extends Command
$count = Entry::where('state', 'rejected')
->where('rejected_at', '<', now()->subDays($days))
->delete();
$count += News::where('state', 'rejected')
->where('rejected_at', '<', now()->subDays($days))
->delete();
$this->info("Deleted {$count} entries");
$this->info("Deleted {$count} entries/news");
return self::SUCCESS;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use App\Models\Entry;
#[Signature('entries:purge-featured {--days=15}')]
#[Description('Remove Featured from entries higher than X days')]
class PurgeFeaturedEntries extends Command
{
public function handle()
{
$days = $this->option('days');
$cutoff = now()->subDays($days);
$count = Entry::query()
->where('featured', true)
->where('featured_at', '<=', $cutoff)
->update([
'featured' => false,
'featured_at' => null,
]);
$this->info("$count entr" . ($count > 1 ? 'ies' : 'y') . " unfeatured.");
return self::SUCCESS;
}
}