is_admin) { return $next($request); } return redirect(route('dashboard'))->with('error', 'You are not authorized to perform this action'); } }