role, $roles) || in_array(Auth::user()->role, ['pemerintah', 'investor', 'akademisi', 'umkm', 'komunitas']))) { // return $next($request); // } // } // Auth::logout(); // return redirect()->route('login')->with('status', 'You are not authorized to access this page.'); // } public function handle(Request $request, Closure $next, ...$roles) { if (Auth::check() && in_array(Auth::user()->role, $roles)) { return $next($request); } Auth::logout(); return redirect()->route('login')->with('status', 'You are not authorized to access this page.'); } }