Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
75.00% |
6 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| FetchNewArticlesCommand | |
75.00% |
6 / 8 |
|
0.00% |
0 / 1 |
3.14 | |
0.00% |
0 / 1 |
| handle | |
75.00% |
6 / 8 |
|
0.00% |
0 / 1 |
3.14 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Console\Commands; |
| 4 | |
| 5 | use App\Jobs\ArticleDiscoveryJob; |
| 6 | use App\Models\Feed; |
| 7 | use App\Models\Setting; |
| 8 | use Illuminate\Console\Command; |
| 9 | |
| 10 | class FetchNewArticlesCommand extends Command |
| 11 | { |
| 12 | protected $signature = 'article:refresh'; |
| 13 | |
| 14 | protected $description = 'Fetches latest articles'; |
| 15 | |
| 16 | public function handle(): int |
| 17 | { |
| 18 | if (!Setting::isArticleProcessingEnabled()) { |
| 19 | $this->info('Article processing is disabled. Article discovery skipped.'); |
| 20 | |
| 21 | return self::SUCCESS; |
| 22 | } |
| 23 | |
| 24 | if (!Feed::where('is_active', true)->exists()) { |
| 25 | $this->info('No active feeds found. Article discovery skipped.'); |
| 26 | |
| 27 | return self::SUCCESS; |
| 28 | } |
| 29 | |
| 30 | ArticleDiscoveryJob::dispatch(); |
| 31 | |
| 32 | return self::SUCCESS; |
| 33 | } |
| 34 | } |