From a689b2dfa4ef2b17d9a477c59703cc28a5a69cfd Mon Sep 17 00:00:00 2001 From: Tim Joosten Date: Fri, 23 Jun 2017 01:15:10 +0200 Subject: [PATCH] Fix #31: Create tab menu for the notifications. --- .../Controllers/NotificationsController.php | 2 +- app/Http/Controllers/RoleController.php | 2 +- resources/views/notifications/index.blade.php | 110 ++++++++++++------ 3 files changed, 77 insertions(+), 37 deletions(-) diff --git a/app/Http/Controllers/NotificationsController.php b/app/Http/Controllers/NotificationsController.php index 880e945..05a65d0 100755 --- a/app/Http/Controllers/NotificationsController.php +++ b/app/Http/Controllers/NotificationsController.php @@ -38,7 +38,7 @@ public function __construct() */ public function index() { - return view('notifications.index'); + return view('notifications.index', compact('notifications')); } /** diff --git a/app/Http/Controllers/RoleController.php b/app/Http/Controllers/RoleController.php index cb99f1d..55498c2 100755 --- a/app/Http/Controllers/RoleController.php +++ b/app/Http/Controllers/RoleController.php @@ -97,7 +97,7 @@ public function destroy($roleId) { try { $role = Role::findOrFail($roleId); - $role->syncPermissions([]); + $role->syncPermissions([]); // Empty relation for clearing the permissions relation. $role->delete(); flash('We have deleted the permission group'); diff --git a/resources/views/notifications/index.blade.php b/resources/views/notifications/index.blade.php index 96bd74b..a32ef4b 100755 --- a/resources/views/notifications/index.blade.php +++ b/resources/views/notifications/index.blade.php @@ -6,10 +6,10 @@
{{-- Sidebar --}}
{{-- Content --}} - @if (auth()->user()->unreadNotifications->count() > 0) -
-
Notifications
- - -
- @else -
- -

No notifications

-

You've read all your notifications. Good job!

-
- @endif +
+
{{-- Unread notifications tab --}} + @if (auth()->user()->unreadNotifications->count() > 0) +
+
Unread notifications
+ + +
+ @else +
+ +

No notifications

+

You've read all your notifications. Good job!

+
+ @endif +
{{-- End unread notifications tab --}} + +
{{-- All notifications tab --}} + @if (auth()->user()->notifications->count() > 0) {{-- There are notifications found. --}} + @php $notifications = auth()->user()->notifications()->simplePaginate(25); @endphp + +
+
All notifications
+ + +
+ + {!! $notifications->render() !!} {{-- Simple pagination instance --}} + @else {{-- Thuere are no notifications. --}} +
+ +

Notifications

+

You have no notifications in the system.

+
+ @endif +
{{-- /Notifications tab. --}} +
{{-- /Content --}}
@endsection