check() && auth()->user()->type === 'Admin') { return $next($request); } if ($request->ajax()) { $errorCode = 403; $result = [ "message" => '권한이 없습니다.', "success" => false, "data" => [], "errors" => [] ]; // logger(json_decode(json_encode($result), true)); $headers = []; return response()->json($result, $errorCode, $headers, JSON_UNESCAPED_UNICODE); } else { $data = [ 'exception' => new AccessDeniedHttpException() ]; return response()->view('errors', $data); } } }