diff --git a/app/Jobs/GamesStatusUpdate.php b/app/Jobs/GamesStatusUpdate.php index c724c34..63f6d08 100644 --- a/app/Jobs/GamesStatusUpdate.php +++ b/app/Jobs/GamesStatusUpdate.php @@ -19,9 +19,9 @@ class GamesStatusUpdate */ public function handle() { - /** @var \Illuminate\Database\Eloquent\Collection */ + /** @var \Illuminate\Database\Eloquent\Collection */ $gamesListToUnPublish = Game::query() - ->where('unpublish_at', '<=', Carbon::now()->toDateTime()) + ->where('unpublish_at', '<=', Carbon::now()) ->whereNotNull('unpublish_at') ->where('published', true)->get(); Log::debug(__CLASS__ . " games to unpublish " . $gamesListToUnPublish->count()); @@ -31,18 +31,19 @@ class GamesStatusUpdate $game->published = false; $game->saveOrFail(); } - /** @var \Illuminate\Database\Eloquent\Collection */ + /** @var \Illuminate\Database\Eloquent\Collection */ $gamesListToPublish = Game::query() - ->where('publish_at', '<=', Carbon::now()->toDateTime()) + ->where('publish_at', '<=', Carbon::now()) ->whereNotNull('publish_at') ->where('published', false)->get(); Log::debug(__CLASS__ . " games to publish " . $gamesListToPublish->count()); // Unpublish all game with no date because only 1 game can be published. if ($gamesListToPublish->count()) { - Game::query()->where('published', true)->each(function (Game $game) { - $game->published = false; - $game->saveOrFail(); - }); + Game::query()->where('published', true) + ->each(function (Game $game) { + $game->published = false; + $game->saveOrFail(); + }); } foreach ($gamesListToPublish as $game) { $game->publish_at = null; diff --git a/app/Jobs/NewsStatusUpdate.php b/app/Jobs/NewsStatusUpdate.php index 5e13fe4..aa2d221 100644 --- a/app/Jobs/NewsStatusUpdate.php +++ b/app/Jobs/NewsStatusUpdate.php @@ -19,9 +19,9 @@ class NewsStatusUpdate */ public function handle() { - /** @var \Illuminate\Database\Eloquent\Collection */ + /** @var \Illuminate\Database\Eloquent\Collection */ $newsListToPublish = News::query() - ->where('publish_at', '<=', Carbon::now()->toDateTime()) + ->where('publish_at', '<=', Carbon::now()) ->whereNotNull('publish_at') ->where('published', false)->get(); Log::debug(__CLASS__ . " news to publish " . $newsListToPublish->count()); @@ -30,9 +30,9 @@ class NewsStatusUpdate $news->published = true; $news->saveOrFail(); } - /** @var \Illuminate\Database\Eloquent\Collection */ + /** @var \Illuminate\Database\Eloquent\Collection */ $newsListToUnPublish = News::query() - ->where('unpublish_at', '<=', Carbon::now()->toDateTime()) + ->where('unpublish_at', '<=', Carbon::now()) ->whereNotNull('unpublish_at') ->where('published', true)->get(); Log::debug(__CLASS__ . " news to unpublish " . $newsListToPublish->count());