user(); if ($user && $user->role == 1) { // Adjust 'role' based on your user model return $next($request); } return redirect('/notifications')->with('error', 'Unauthorized access.'); } }