From 3b04e2d234865d786fea50adfc5e8611777089bb Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 29 Jun 2025 15:55:06 +0200 Subject: [PATCH] WIP --- .env | 3 +++ app/Listeners/CheckArticleKeywords.php | 7 ++++--- app/Listeners/PublishArticle.php | 6 ++++-- routes/console.php | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 6750a7a..e4d0c7c 100644 --- a/.env +++ b/.env @@ -4,6 +4,9 @@ APP_KEY=base64:2cskqsDdzSN+zMt3p+b9AJlGQf+HImWbQ4wSXdNy65Y= APP_DEBUG=true APP_URL=http://localhost +WWWWUSER=1000 +WWWGROUP + APP_LOCALE=en APP_FALLBACK_LOCALE=en APP_FAKER_LOCALE=en_US diff --git a/app/Listeners/CheckArticleKeywords.php b/app/Listeners/CheckArticleKeywords.php index f4a5983..027041a 100644 --- a/app/Listeners/CheckArticleKeywords.php +++ b/app/Listeners/CheckArticleKeywords.php @@ -15,13 +15,14 @@ public function __construct() public function handle(ArticleFetched $event): void { logger('Checking keywords for article: ' . $event->article->id); - + // TODO: Add actual keyword checking logic here // For now, mark all articles as relevant + $isRelevant = true; - + $event->article->update(['is_relevant' => $isRelevant]); - + if ($isRelevant) { event(new ArticleReadyToPublish($event->article)); } diff --git a/app/Listeners/PublishArticle.php b/app/Listeners/PublishArticle.php index 10cfb95..5afd219 100644 --- a/app/Listeners/PublishArticle.php +++ b/app/Listeners/PublishArticle.php @@ -13,7 +13,9 @@ public function __construct() public function handle(ArticleReadyToPublish $event): void { - logger('Publishing article: ' . $event->article->id); + $article = $event->article; + + logger('Publishing article: ' . $article->id . ' : ' . $article->url); // TODO: Add actual publishing logic here } -} \ No newline at end of file +} diff --git a/routes/console.php b/routes/console.php index aa1da9f..f90c34a 100644 --- a/routes/console.php +++ b/routes/console.php @@ -3,4 +3,4 @@ use App\Console\Commands\FetchNewArticlesCommand; use Illuminate\Support\Facades\Schedule; -Schedule::command(FetchNewArticlesCommand::class)->hourly(); +Schedule::command(FetchNewArticlesCommand::class)->everyMinute();