Files
dredgenews/app/Console/Commands/FetchFeeds.php
T
dredgy 439139a057
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
Done
2026-07-04 23:09:00 +10:00

26 lines
632 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\Feed;
use App\Services\FeedFetcher;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
#[Signature('feeds:fetch')]
#[Description('Fetch feeds')]
class FetchFeeds extends Command
{
protected $signature = 'feeds:fetch';
public function handle(FeedFetcher $fetcher): void
{
Feed::query()->chunk(50, function ($feeds) use ($fetcher) {
foreach ($feeds as $feed) {
dispatch(fn () => $fetcher->fetch($feed))->onQueue('feeds');
}
});
}
}