(Update) HomeController.php

Add 'new_news' flag for articles less than 3 days old
This commit is contained in:
innocente205
2020-04-30 15:43:36 +07:00
committed by GitHub
parent fe33f67ad6
commit 64c51e92f5
+3
View File
@@ -51,6 +51,9 @@ class HomeController extends Controller
// Latest Articles/News Block
$articles = cache()->remember('latest_article', $expiresAt, fn () => Article::latest()->take(1)->get());
foreach ($articles as $article) {
$article->new_news=($user->updated_at->subDays(3)->getTimestamp() < $article->created_at->getTimestamp()) ? 1 : 0 ;
}
// Latest Torrents Block
$personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first();