27 lines
581 B
PHP
27 lines
581 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Jobs\ArticleDiscoveryJob;
|
|
use App\Models\Feed;
|
|
use Illuminate\Console\Command;
|
|
|
|
class FetchNewArticlesCommand extends Command
|
|
{
|
|
protected $signature = 'article:refresh';
|
|
|
|
protected $description = 'Fetches latest articles';
|
|
|
|
public function handle(): int
|
|
{
|
|
if (!Feed::where('is_active', true)->exists()) {
|
|
$this->info('No active feeds found. Article discovery skipped.');
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
|
|
ArticleDiscoveryJob::dispatch();
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|