First Commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\View\Composers;
|
||||
|
||||
use App\Models\UserNotification;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class NavigationComposer
|
||||
{
|
||||
public function compose(View $view): void
|
||||
{
|
||||
if (Auth::check()) {
|
||||
$view->with('unreadNotifications', UserNotification::where('user_id', Auth::id())
|
||||
->where('is_read', false)
|
||||
->orderByDesc('created_at')
|
||||
->get());
|
||||
} else {
|
||||
$view->with('unreadNotifications', collect());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user