Exploración de los recursos existentes de la ruta.

@param  string  $route
@param  function  $closure
@param  \Fundamentary\Http\Request  $request
14181
public static function explorer($route, $controller, $closure = null, $request) {
        $data = $dataAux = $request->bodyRequest(true);
        $controller = explode('@', $controller);
        $methodController = $controller[1];
        $controller = $controller[0];

        if(file_exists(Dir::controller($controller))) {

            if($closure)
                $data = call_user_func_array(
                    $closure,
                    array('request' => $data)
                );

            if($data === $dataAux) {
                $routeController = Dir::apiControllers($controller);
                $ctr = new $routeController();

                if(!method_exists($ctr, $methodController)) killer('404');

                $data = $ctr->$methodController($data);
                KernelHttp::makeResponse('200', $data);
            }

        } else
            killer('401');
    }
981663
public function handle($request, Closure $next)
    {
        $resource = $request->route()->getActionName();
        $permission = Permission::where('resource', '=', $resource)->first();

        // If the specific route requires permissions
        if ($permission) {
            // Get user permissions
            try {
                $user_permissions = Auth::user()->role->permissions->keyBy('resource');
            } catch (\Exception $e) {
                return abort(401, trans('acl::general.messages.user_permissions_not_found'));
            }

            // And the user has permissions
            if (! $user_permissions->has($resource)) {
                return abort(401, trans('acl::general.messages.no_permissions'));
            }
        }

        return $next($request);
    }
1101278
public function handle(Request $request, Closure $next)
    {
        // If the request URL is ignored from localization.
        if ($this->shouldIgnore($request)) return $next($request);

        if ($redirectUrl = $this->getRedirectionUrl($request)) {
            // Save any flashed data for redirect
            session()->reflash();

            return $this->makeRedirectResponse($redirectUrl);
        }

        return $next($request);
    }
55542
public function handle($request, Closure $next)
    {
        // Get the required roles from the route
        $roles = $this->getRequiredRoleForRoute($request->route());
        // Check if a role is required for the route, and
        // if so, ensure that the user has that role.
        if ($request->user()->hasRole($roles) || !$roles) {
            return $next($request);
        }

        return response([
            'error' => [
                'code' => 'INSUFFICIENT_ROLE',
                'description' => 'You are not authorized to access this resource.',
            ],
        ], 401);
    }
817091
public function handle($request, \Closure $next) {
        $dir = base_path('bootstrap/ng');
        if(is_dir($dir)) {
            $routes = rglob('*.php', 0, $dir);
            foreach($routes as $route) {
                include_once $route;
            }
            
        }
        $package = \Larakit\StaticFiles\Manager::package('larakit');
        $package->js('/!/lk-angular-js');
        foreach(LkNgComponent::all() as $path) {
            $file = public_path($path . 'component.js');
            if(file_exists($file)) {
                $package->js($path . 'component.js');
            }
            $file = public_path($path . 'component.css');
            if(file_exists($file)) {
                $package->css($path . 'component.css');
            }
        }
        //        dump(__FILE__);
        $package->js('/!/lkng/routes', null, -1);
        
        return $next($request);
    }
662209
public function handle($request, Closure $next)
    {
        if (env('APP_ENV') !== 'testing') {
            header('Access-Control-Allow-Origin: *');
            header('Access-Control-Allow-Credentials: true');
            header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
            header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, token, _');
            header('Content-Type: application/json; charset=utf-8');
        }

        if ($request->getRealMethod() == 'OPTIONS') {
            return new \Illuminate\Http\Response('OK', 200);
        }

        return $next($request);
    }
1295268
public function handle(Request $request, \Closure $next, $permission)
    {
        if (!$this->keeper->check() || !$this->keeper->hasPermission($permission)) {
            $router = $this->container->make('router');
            $log    = $this->container->make('log');

            $currentRoute = $router->current();

            // If user is not authenticated redirect to login route
            if (!$this->keeper->check()) {
                $config   = $this->container->make('config');
                $redirect = $this->container->make('redirect');
                $url      = $this->container->make('url');

                $log->notice('Guest redirected to login screen', [
                    'from' => $currentRoute->getName(),
                    'to'   => $config->get('vi-kon.auth.login.route'),
                ]);

                return $redirect->guest($url->route($config->get('vi-kon.auth.login.route')));
            }

            // If user is authenticated but has no permission to access given route then redirect to 403 route
            if (!$this->keeper->hasPermission($permission)) {
                $log->notice('User has no permission to view page', [
                    'user'       => $this->keeper->user()->toArray(),
                    'permission' => $permission,
                    'route'      => $currentRoute->getName(),
                ]);

                throw new AccessDeniedHttpException();
            }
        }

        return $next($request);
    }
986384
public function handle($request, Closure $next)
    {
        \App::setLocale(\Routelocale::getLocaleFromRoute());
        return $next($request);;
    }
601475
public function handle($request, Closure $next)
    {
        $response = $next($request);
        try
        {
            if (method_exists($response, 'getOriginalContent')) 
            {
                $data = $response->getOriginalContent();
                if(isset($data['data']) && !empty($data['data']))
                {
                    if ($request->wantsJson() || !isset($data['view']))) 
                    {
                        $response=response()->json($data['data']);
                        $response->header('Content-Length',mb_strlen($response->getContent()));
                    } 
                    else 
                    {
                        $response=response()->view($data['view'], $data['data']);
                    }
                }
            }
            
        }
        catch(BadMethodCallException $e)
        {
            
        }
        return $response;
    }
464288
public function handle(Request $request, Closure $next)
    {
        // If the request URL is ignored from localization.
        if ($this->shouldIgnore($request)) return $next($request);

        $this->localization->setRouteNameFromRequest($request);

        return $next($request);
    }
209437
public function handle($request, Closure $next)
    {

        if ($request->session()->has('language')) {
            $local = $request->session()->get('language', config('app.locale'));
            app()->setLocale($local);
        }

        return $next($request);
    }
503314
public function handle(Request $request, Closure $next)
    {
        // If the request URL is ignored from localization.
        if ($this->shouldIgnore($request)) return $next($request);

        return is_null($translatedUrl = $this->getTranslatedUrl($request))
            ? $next($request)
            : $this->makeRedirectResponse($translatedUrl);
    }
4140
public function handle($request, Closure $next)
    {
        if (! $this->checkIfUserCanViewPost($request)) {
            return redirect()->route('/');
        }

        return $next($request);
    }
949967
public function handle($request, Closure $next)
    {
        $response = $next($request);

        if (! $this->shouldProcessPageSpeed($request, $response)) {
            return $response;
        }

        $html = $response->getContent();
        $newContent = $this->apply($html);

        return $response->setContent($newContent);
    }
1244354
protected function dispatchMethod($request, $route)
    {
        list($path, $var) = $this->parseUrlPath($route);

        $route = str_replace('/', '@', implode('/', $path));
        $method = strpos($route, '@') ? explode('@', $route) : $route;

        return new CallbackDispatch($request, $this, $method, $var);
    }
340673
public function handle($request, Closure $next)
    {
        $route = $this->router->current()->methods()[0] . ' /' . $this->router->current()->uri();

        $isPermissionAllRoutes = RoutePermissionModel::getRoutePermissionsRoles('*');
        if ($isPermissionAllRoutes) {
            if (($user = $this->user($request)) === 401) {
                return response()->json(null, 401);
            }

            $hasRole  = $user->hasRole($isPermissionAllRoutes->roles, false);
            $hasPerms = $user->can($isPermissionAllRoutes->permissions, false);

            $hasRolePerm = $hasRole || $hasPerms || (is_array($isPermissionAllRoutes->roles) && in_array('@', $isPermissionAllRoutes->roles));

            if (!$hasRolePerm) {
                return response()->json(null, 403);
            }
        }

        $routePermission = RoutePermissionModel::getRoutePermissionsRoles($route);
        if ($routePermission) {
            if (($user = $this->user($request)) === 401) {
                return response()->json(null, 401);
            }

            $hasRole  = $user->hasRole($routePermission->roles, false);
            $hasPerms = $user->can($routePermission->permissions, false);

            $hasRolePerm = $hasRole || $hasPerms || (is_array($routePermission->roles) && in_array('@', $routePermission->roles));

            if (!$hasRolePerm) {
                return response()->json(null, 403);
            }
        }

        return $next($request);
    }
941469
protected function executeAction(Route $route): Response
	{
		$action = $route->getAction();

		$parameters = $route->getParameters();

		if($action instanceof Closure)
		{
			return $this->executeClosure($action, $parameters);
		}

		return $this->executeController($action, $parameters);
	}