Files
2026-09-01 07:49:48 -03:00

25 lines
574 B
PHP

<?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());
}
}
}