Done
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user