check()) { return redirect('login'); } $user = auth()->user(); // Assuming StaffMember acts as your Authenticatable user // Check if the user has any of the allowed roles foreach ($roles as $role) { if ($user->hasRole($role)) { return $next($request); } } abort(403, 'Unauthorized action.'); } }