is_admin == 1) { return $next($request); } // Redirect to home or any other page if the user is not admin return redirect('/')->with('error', 'You do not have admin access.'); } }