From 03d6efcba461059d5c2db9206ca65e3123a65093 Mon Sep 17 00:00:00 2001 From: ludoguenet Date: Sat, 9 Mar 2024 18:27:05 +0100 Subject: [PATCH] fix --- app/Providers/ViewServiceProvider.php | 11 +- .../views/components/nudge-search.blade.php | 108 ++++++++++++++++++ resources/views/layouts/navigation.blade.php | 22 ++-- 3 files changed, 132 insertions(+), 9 deletions(-) create mode 100644 resources/views/components/nudge-search.blade.php diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 6a83a7e..feac7f8 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -4,6 +4,7 @@ namespace App\Providers; +use App\Models\Nudge; use App\Models\User; use Illuminate\Support\Facades; use Illuminate\Support\ServiceProvider; @@ -27,7 +28,15 @@ public function boot(): void /** @var ?User $user */ $user = auth()->user(); - $view->with(['notificationCount' => (int) ($user ? $user->refresh()->unreadNotifications->count() : 0)]); + $nudges = Nudge::query() + ->with('user') + ->validated() + ->get(); + + $view->with([ + 'notificationCount' => (int) ($user ? $user->refresh()->unreadNotifications->count() : 0), + 'nudges' => $nudges, + ]); }); } } diff --git a/resources/views/components/nudge-search.blade.php b/resources/views/components/nudge-search.blade.php new file mode 100644 index 0000000..587a649 --- /dev/null +++ b/resources/views/components/nudge-search.blade.php @@ -0,0 +1,108 @@ +@props([ +'nudges', +]) + +
+
+ + + +
    + + +
+ +
+
+ +@push('scripts') + +@endpush diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 24f2602..70f3d95 100644 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -1,7 +1,7 @@