27 lines
550 B
PHP
27 lines
550 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\Article;
|
|
use App\Services\Article\ArticleFetcher;
|
|
use Illuminate\Console\Command;
|
|
|
|
class FetchArticleCommand extends Command
|
|
{
|
|
protected $signature = 'article:fetch {url}';
|
|
|
|
protected $description = 'Fetch article from url';
|
|
|
|
public function handle(): int
|
|
{
|
|
$article = Article::createQuietly([
|
|
'url' => $this->argument('url'),
|
|
]);
|
|
|
|
$res = ArticleFetcher::fetchArticleData($article);
|
|
|
|
dump($res);
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|