fail(__('admin.unauthorized')); } if (!$user->isAdministrator()) { return Admin::response()->fail(__('admin.unauthorized')); } if (count($args) == 0) { $args = [$request->route()->getName()]; } if ($user->allPermissions()->whereIn('slug', $args)->count() == 0) { return Admin::response()->fail(__('admin.unauthorized'), ['permission' => $args]); } return $next($request); } }