Skip to content

Commit acdb959

Browse files
committed
✨ modification de la commande de publication sur Telegram
1 parent 3258eb7 commit acdb959

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/Console/Commands/PostArticleToTelegram.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public function handle(AnonymousNotifiable $notifiable): void
1717
{
1818
if ($article = Article::nexForSharingToTelegram()) {
1919
$notifiable->notify(new PostArticleToTelegramNotification($article));
20+
21+
$article->markAsPublish();
2022
}
2123
}
2224
}

app/Models/Article.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,13 @@ public static function nexForSharingToTelegram(): ?self
334334
{
335335
return self::shared()
336336
->published()
337+
->whereNull('tweet_id')
337338
->orderBy('submitted_at', 'asc')
338339
->first();
339340
}
341+
342+
public function markAsPublish()
343+
{
344+
$this->update(['tweet_id' => $this->author->id]);
345+
}
340346
}

0 commit comments

Comments
 (0)