From ebff0588bd7f72d5b8377d210126f9c786b91ee1 Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Tue, 24 Oct 2023 14:30:32 +0300 Subject: [PATCH] fix activity log and order in front page --- app/Http/Controllers/HomeController.php | 7 +++---- app/Models/Activity.php | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5620b4db..2df303ea 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -17,8 +17,6 @@ class HomeController extends Controller { public function index() { - $articles = Article::latest()->take(3)->get(); - return Inertia::render('Public/Home', [ 'projects_count' => Project::query() ->whereIsOpen() @@ -30,13 +28,14 @@ public function index() 'projects' => ProjectCardResource::collection( Project::whereIsOpen() - ->inRandomOrder() + ->latest() ->limit(12) ->get() ), 'bcr_projects' => BCRProjectCardResource::collection( BCRProject::query() + ->latest() ->with('county') ->limit(12) ->get() @@ -44,8 +43,8 @@ public function index() 'articles' => ArticleCardResource::collection( Article::query() + ->latest() ->wherePublished() - ->inRandomOrder() ->limit(3) ->get() ), diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 1324baaa..b880740a 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -142,6 +142,7 @@ public function approve(): void $media = Media::find($value); $this->subject->media->add($media); } + $this->subject->save(); } else { $this->subject->save(); }