Files
mtdb_movie/app/Console/Commands/UpdateSeasonsFromRemote.php
maher 703f50a09d
Some checks failed
Build / run (push) Has been cancelled
first commit
2025-10-29 11:42:25 +01:00

28 lines
605 B
PHP
Executable File

<?php
namespace App\Console\Commands;
use App\Models\Season;
use Illuminate\Console\Command;
class UpdateSeasonsFromRemote extends Command
{
protected $signature = 'seasons:update';
public function handle(): void
{
$seasons = Season::orderBy('updated_at', 'asc')
->with('title')
->limit(50)
->get();
$this->withProgressBar($seasons, function (Season $season) {
if ($season->title) {
$season->maybeUpdateFromExternal($season->title);
}
});
$this->info('Seasons updated');
}
}