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