From d9c0736721d95fc291c0d75ed0e2a51e899dd90b Mon Sep 17 00:00:00 2001 From: fsociety Date: Fri, 25 Oct 2024 15:18:26 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(news):=20order=20notifications?= =?UTF-8?q?=20by=20creation=20date=20in=20news=20index=20and=20on=20create?= =?UTF-8?q?/delete=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/pages/association/news/index.blade.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/views/pages/association/news/index.blade.php b/resources/views/pages/association/news/index.blade.php index 5be9d42..6a2e105 100644 --- a/resources/views/pages/association/news/index.blade.php +++ b/resources/views/pages/association/news/index.blade.php @@ -22,7 +22,9 @@ usesFileUploads(); state([ 'file', 'news' => fn() - => \App\Models\Notification::query()->get(), + => \App\Models\Notification::query() + ->orderBy('created_at', 'desc') + ->get(), 'isAllowed' => false, 'canEdit' => false, 'currentPubkey' => null, @@ -55,7 +57,9 @@ $save = function () { 'file' => 'required|file|mimes:pdf|max:1024', ]); - $notification = \App\Models\Notification::query()->create([ + $notification = \App\Models\Notification::query() + ->orderBy('created_at', 'desc') + ->create([ 'einundzwanzig_pleb_id' => $this->currentPleb->id, 'category' => $this->form->category, 'name' => $this->form->name, @@ -69,7 +73,9 @@ $save = function () { $this->form->reset(); $this->file = null; - $this->news = \App\Models\Notification::query()->get(); + $this->news = \App\Models\Notification::query() + ->orderBy('created_at', 'desc') + ->get(); }; $delete = function($id) { @@ -88,7 +94,9 @@ $delete = function($id) { $deleteNow = function($id) { $notification = \App\Models\Notification::query()->find($id); $notification->delete(); - $this->news = \App\Models\Notification::query()->get(); + $this->news = \App\Models\Notification::query() + ->orderBy('created_at', 'desc') + ->get(); }; ?>