return self::processContent($content);
} catch(Exception $e) {
\Log::error("[PublicController: _helperGetContentByCode] Error: ".$e->getMessage());
return null;
}
}
/**
* Support function to load content details
*
* @param $content Content object (without sections and other details)
* @return object Content object with full details
*/
private static function processContent($content) {
# \Log::debug("[PublicController: processContent] init - id: ".$content->id." code: ".$content->code);
$lang = HelperController::getCurrentLanguage(true);
$data = Cache::rememberForever(self::CONTENT_CACHE_CODE.'_'.self::SITE_NAME.'_'.$content->id.'_'.$lang->code, function() use($content) {
\Log::debug("[PublicController: processContent] NOT in cache - id: ".$content->id." code: ".$content->code);
return ContentsController::processContent($content);
});
# \Log::debug("[PublicController: processContent] Content processed: ".$data->code);
return $data;
}
private static function processContentVersion($content, $version) {
try {
# \Log::debug("[PublicController: processContentVersion] init - id: ".$content->id." code: ".$content->code);
return ContentsController::processContentVersion($content, $version);
} catch(Exception $e) {
\Log::error("[PublicController: processContentVersion] Error: ".$e->getMessage());
return null;
}
}
"Trying to get property 'id' of non-object"
return self::processContent($content);
} catch(Exception $e) {
\Log::error("[PublicController: _helperGetContentByCode] Error: ".$e->getMessage());
return null;
}
}
/**
* Support function to load content details
*
* @param $content Content object (without sections and other details)
* @return object Content object with full details
*/
private static function processContent($content) {
# \Log::debug("[PublicController: processContent] init - id: ".$content->id." code: ".$content->code);
$lang = HelperController::getCurrentLanguage(true);
$data = Cache::rememberForever(self::CONTENT_CACHE_CODE.'_'.self::SITE_NAME.'_'.$content->id.'_'.$lang->code, function() use($content) {
\Log::debug("[PublicController: processContent] NOT in cache - id: ".$content->id." code: ".$content->code);
return ContentsController::processContent($content);
});
# \Log::debug("[PublicController: processContent] Content processed: ".$data->code);
return $data;
}
private static function processContentVersion($content, $version) {
try {
# \Log::debug("[PublicController: processContentVersion] init - id: ".$content->id." code: ".$content->code);
return ContentsController::processContentVersion($content, $version);
} catch(Exception $e) {
\Log::error("[PublicController: processContentVersion] Error: ".$e->getMessage());
return null;
}
}
8
"Trying to get property 'id' of non-object"
"/var/www/html/app/Modules/Cms/Controllers/PublicController.php"
770
array:2 [ "content" => null "lang" => App\Modules\Cms\Models\Language {#1936} ]
*
* @param Request $request Request
* @param string $slug Slug
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|void View to show
*/
public function pageBySlug(Request $request, $slug = 'home') {
try {
$item = self::validateSlug($slug);
if(!($item instanceof Slug)) {
\Log::debug("[PublicController: pageBySlug] Process validate request");
return $item;
}
//get current language
$lang = HelperLang::_helperGetLanguage();
if($item->content_type === Content::class) {
# \Log::debug("[PublicController: pageBySlug] Content");
$content = self::processContent($item->content);
$metaTags = $content->metaTags;
$noNewsCurrentLanguage = false;
if(empty($content->version->first()->translations->first()->name)){
$noNewsCurrentLanguage = true;
\Log::error("[PublicController: pageBySlug] Unknown item type");
return view('public.page', compact( 'content', 'metaTags', 'noNewsCurrentLanguage'));
}
if($content->version->first()){
$disabledLanguages = json_decode($content->version->first()->disabled_languages);
if(!empty($disabledLanguages) && in_array($lang->code, $disabledLanguages)){
return abort(404);
}
}
$slugs = [
'pt' => $content->slugs->where('language_id','=',1)->first()->code == 'home'? '' : $content->slugs->where('language_id','=',1)->first()->code,
'en' => $content->slugs->where('language_id','=',2)->first()->code == 'home'? '' : $content->slugs->where('language_id','=',2)->first()->code,
null
/**
* Get the middleware assigned to the controller.
*
* @return array
*/
public function getMiddleware()
{
return $this->middleware;
}
/**
* Execute an action on the controller.
*
* @param string $method
* @param array $parameters
* @return \Symfony\Component\HttpFoundation\Response
*/
public function callAction($method, $parameters)
{
return call_user_func_array([$this, $method], $parameters);
}
/**
* Handle calls to missing methods on the controller.
*
* @param string $method
* @param array $parameters
* @return mixed
*
* @throws \BadMethodCallException
*/
public function __call($method, $parameters)
{
throw new BadMethodCallException(sprintf(
'Method %s::%s does not exist.', static::class, $method
));
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
"quinta-de-honor"
/**
* Get the middleware assigned to the controller.
*
* @return array
*/
public function getMiddleware()
{
return $this->middleware;
}
/**
* Execute an action on the controller.
*
* @param string $method
* @param array $parameters
* @return \Symfony\Component\HttpFoundation\Response
*/
public function callAction($method, $parameters)
{
return call_user_func_array([$this, $method], $parameters);
}
/**
* Handle calls to missing methods on the controller.
*
* @param string $method
* @param array $parameters
* @return mixed
*
* @throws \BadMethodCallException
*/
public function __call($method, $parameters)
{
throw new BadMethodCallException(sprintf(
'Method %s::%s does not exist.', static::class, $method
));
}
}
array:2 [ 0 => App\Modules\Cms\Controllers\PublicController {#1629} 1 => "pageBySlug" ]
array:2 [ 0 => Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" } "slug" => "quinta-de-honor" ]
{
$this->container = $container;
}
/**
* Dispatch a request to a given controller and method.
*
* @param \Illuminate\Routing\Route $route
* @param mixed $controller
* @param string $method
* @return mixed
*/
public function dispatch(Route $route, $controller, $method)
{
$parameters = $this->resolveClassMethodDependencies(
$route->parametersWithoutNulls(), $controller, $method
);
if (method_exists($controller, 'callAction')) {
return $controller->callAction($method, $parameters);
}
return $controller->{$method}(...array_values($parameters));
}
/**
* Get the middleware for the controller instance.
*
* @param \Illuminate\Routing\Controller $controller
* @param string $method
* @return array
*/
public function getMiddleware($controller, $method)
{
if (! method_exists($controller, 'getMiddleware')) {
return [];
}
return collect($controller->getMiddleware())->reject(function ($data) use ($method) {
return static::methodExcludedByOptions($method, $data['options']);
"pageBySlug"
array:2 [ 0 => Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" } "slug" => "quinta-de-honor" ]
protected function runCallable()
{
$callable = $this->action['uses'];
return $callable(...array_values($this->resolveMethodDependencies(
$this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses'])
)));
}
/**
* Run the route action and return the response.
*
* @return mixed
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
protected function runController()
{
return $this->controllerDispatcher()->dispatch(
$this, $this->getController(), $this->getControllerMethod()
);
}
/**
* Get the controller instance for the route.
*
* @return mixed
*/
public function getController()
{
if (! $this->controller) {
$class = $this->parseControllerCallback()[0];
$this->controller = $this->container->make(ltrim($class, '\\'));
}
return $this->controller;
}
/**
*
* @throws \UnexpectedValueException
*/
protected function parseAction($action)
{
return RouteAction::parse($this->uri, $action);
}
/**
* Run the route action and return the response.
*
* @return mixed
*/
public function run()
{
$this->container = $this->container ?: new Container;
try {
if ($this->isControllerAction()) {
return $this->runController();
}
return $this->runCallable();
} catch (HttpResponseException $e) {
return $e->getResponse();
}
}
/**
* Checks whether the route's action is a controller.
*
* @return bool
*/
protected function isControllerAction()
{
return is_string($this->action['uses']);
}
/**
* Run the route action and return the response.
/**
* Run the given route within a Stack "onion" instance.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @return mixed
*/
protected function runRouteWithinStack(Route $route, Request $request)
{
$shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
$this->container->make('middleware.disable') === true;
$middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
return (new Pipeline($this->container))
->send($request)
->through($middleware)
->then(function ($request) use ($route) {
return $this->prepareResponse(
$request, $route->run()
);
});
}
/**
* Gather the middleware for the given route with resolved class names.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
public function gatherRouteMiddleware(Route $route)
{
$middleware = collect($route->gatherMiddleware())->map(function ($name) {
return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups);
})->flatten();
return $this->sortMiddleware($middleware);
}
/**
use Symfony\Component\Debug\Exception\FatalThrowableError;
/**
* This extended pipeline catches any exceptions that occur during each slice.
*
* The exceptions are converted to HTTP responses for proper middleware handling.
*/
class Pipeline extends BasePipeline
{
/**
* Get the final piece of the Closure onion.
*
* @param \Closure $destination
* @return \Closure
*/
protected function prepareDestination(Closure $destination)
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
$supportedLocales = app('laravellocalization')->getSupportedLocales();
$defaultLanguage = $languages->where('default', true)->isNotEmpty() ? $languages->where('default', true)->first()->code : 'en';
$currentLanguage = HelperController::getCurrentLanguage(true)->code;
if(empty($currentLocale = $request->segment(1, null)) || !array_key_exists($currentLocale, $supportedLocales) || $languages->where('code', $currentLocale)->where('public','=',true)->isEmpty()){
if($request->ajax()){
$currentLocale = $currentLanguage;
}else{
$redirectUrl = app('laravellocalization')->getLocalizedURL($defaultLanguage, str_replace('http:','https:',$request->fullUrl()));
return new RedirectResponse($redirectUrl, 302, ['Vary' => 'Accept-Language']);
}
}
if(!Cookie::has('currentLanguage') || $currentLocale != $currentLanguage){
$request->session()->flash('currentLanguage', $currentLocale);
Cookie::queue(Cookie::forever('currentLanguage', $currentLocale));
}
return $next($request);
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1654 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
namespace App\Http\Middleware;
use Closure;
class SlowNetwork
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (env('ENABLE_SLOW_NETWORK')) {
sleep(env('ENABLE_SLOW_NETWORK_TIME'));
}
return $next($request);
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1859 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
*/
public function __construct(Registrar $router)
{
$this->router = $router;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$this->router->substituteBindings($route = $request->route());
$this->router->substituteImplicitBindings($route);
return $next($request);
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1860 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*
* @throws \Illuminate\Session\TokenMismatchException
*/
public function handle($request, Closure $next)
{
if (
$this->isReading($request) ||
$this->runningUnitTests() ||
$this->inExceptArray($request) ||
$this->tokensMatch($request)
) {
return tap($next($request), function ($response) use ($request) {
if ($this->shouldAddXsrfTokenCookie()) {
$this->addCookieToResponse($request, $response);
}
});
}
throw new TokenMismatchException('CSRF token mismatch.');
}
/**
* Determine if the HTTP request uses a ‘read’ verb.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function isReading($request)
{
return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']);
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1861 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// If the current session has an "errors" variable bound to it, we will share
// its value with all view instances so the views can easily access errors
// without having to bind. An empty bag is set when there aren't errors.
$this->view->share(
'errors', $request->session()->get('errors') ?: new ViewErrorBag
);
// Putting the errors in the view for every view allows the developer to just
// assume that some errors are always available, which is convenient since
// they don't have to continually run checks for the presence of errors.
return $next($request);
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1862 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (! $this->sessionConfigured()) {
return $next($request);
}
// If a session driver has been configured, we will need to start the session here
// so that the data is ready for an application. Note that the Laravel sessions
// do not make use of PHP "native" sessions in any way since they are crappy.
$request->setLaravelSession(
$session = $this->startSession($request)
);
$this->collectGarbage($session);
$response = $next($request);
$this->storeCurrentUrl($request, $session);
$this->addCookieToResponse($response, $session);
// Again, if the session has been configured we will need to close out the session
// so that the attributes may be persisted to some storage medium. We will also
// add the session identifier cookie to the application response headers now.
$this->saveSession($request);
return $response;
}
/**
* Start the session for the given request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\Session\Session
*/
protected function startSession(Request $request)
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1863 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
* Create a new CookieQueue instance.
*
* @param \Illuminate\Contracts\Cookie\QueueingFactory $cookies
* @return void
*/
public function __construct(CookieJar $cookies)
{
$this->cookies = $cookies;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
foreach ($this->cookies->getQueuedCookies() as $cookie) {
$response->headers->setCookie($cookie);
}
return $response;
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1864 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
* Disable encryption for the given cookie name(s).
*
* @param string|array $name
* @return void
*/
public function disableFor($name)
{
$this->except = array_merge($this->except, (array) $name);
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handle($request, Closure $next)
{
return $this->encrypt($next($this->decrypt($request)));
}
/**
* Decrypt the cookies on the request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Request
*/
protected function decrypt(Request $request)
{
foreach ($request->cookies as $key => $cookie) {
if ($this->isDisabled($key)) {
continue;
}
try {
$request->cookies->set($key, $this->decryptCookie($key, $cookie));
} catch (DecryptException $e) {
$request->cookies->set($key, null);
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1865 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
public function via($method)
{
$this->method = $method;
return $this;
}
/**
* Run the pipeline with a final destination callback.
*
* @param \Closure $destination
* @return mixed
*/
public function then(Closure $destination)
{
$pipeline = array_reduce(
array_reverse($this->pipes), $this->carry(), $this->prepareDestination($destination)
);
return $pipeline($this->passable);
}
/**
* Run the pipeline and return the result.
*
* @return mixed
*/
public function thenReturn()
{
return $this->then(function ($passable) {
return $passable;
});
}
/**
* Get the final piece of the Closure onion.
*
* @param \Closure $destination
* @return \Closure
*/
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @return mixed
*/
protected function runRouteWithinStack(Route $route, Request $request)
{
$shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
$this->container->make('middleware.disable') === true;
$middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
return (new Pipeline($this->container))
->send($request)
->through($middleware)
->then(function ($request) use ($route) {
return $this->prepareResponse(
$request, $route->run()
);
});
}
/**
* Gather the middleware for the given route with resolved class names.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
public function gatherRouteMiddleware(Route $route)
{
$middleware = collect($route->gatherMiddleware())->map(function ($name) {
return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups);
})->flatten();
return $this->sortMiddleware($middleware);
}
/**
* Sort the given middleware by priority.
*
Closure($request) {#1657 …4}
return $route;
}
/**
* Return the response for the given route.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Routing\Route $route
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
protected function runRoute(Request $request, Route $route)
{
$request->setRouteResolver(function () use ($route) {
return $route;
});
$this->events->dispatch(new Events\RouteMatched($route, $request));
return $this->prepareResponse($request,
$this->runRouteWithinStack($route, $request)
);
}
/**
* Run the given route within a Stack "onion" instance.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @return mixed
*/
protected function runRouteWithinStack(Route $route, Request $request)
{
$shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
$this->container->make('middleware.disable') === true;
$middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
return (new Pipeline($this->container))
->send($request)
->through($middleware)
Illuminate\Routing\Route {#1553}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
public function dispatch(Request $request)
{
$this->currentRequest = $request;
return $this->dispatchToRoute($request);
}
/**
* Dispatch the request to a route and return the response.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
public function dispatchToRoute(Request $request)
{
return $this->runRoute($request, $this->findRoute($request));
}
/**
* Find the route matching a given request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Routing\Route
*/
protected function findRoute($request)
{
$this->current = $route = $this->routes->match($request);
$this->container->instance(Route::class, $route);
return $route;
}
/**
* Return the response for the given route.
*
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Illuminate\Routing\Route {#1553}
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
public function respondWithRoute($name)
{
$route = tap($this->routes->getByName($name))->bind($this->currentRequest);
return $this->runRoute($this->currentRequest, $route);
}
/**
* Dispatch the request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
public function dispatch(Request $request)
{
$this->currentRequest = $request;
return $this->dispatchToRoute($request);
}
/**
* Dispatch the request to a route and return the response.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/
public function dispatchToRoute(Request $request)
{
return $this->runRoute($request, $this->findRoute($request));
}
/**
* Find the route matching a given request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Routing\Route
*/
protected function findRoute($request)
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
* @return void
*/
public function bootstrap()
{
if (! $this->app->hasBeenBootstrapped()) {
$this->app->bootstrapWith($this->bootstrappers());
}
}
/**
* Get the route dispatcher callback.
*
* @return \Closure
*/
protected function dispatchToRouter()
{
return function ($request) {
$this->app->instance('request', $request);
return $this->router->dispatch($request);
};
}
/**
* Call the terminate method on any terminable middleware.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Response $response
* @return void
*/
public function terminate($request, $response)
{
$this->terminateMiddleware($request, $response);
$this->app->terminate();
}
/**
* Call the terminate method on any terminable middleware.
*
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
use Symfony\Component\Debug\Exception\FatalThrowableError;
/**
* This extended pipeline catches any exceptions that occur during each slice.
*
* The exceptions are converted to HTTP responses for proper middleware handling.
*/
class Pipeline extends BasePipeline
{
/**
* Get the final piece of the Closure onion.
*
* @param \Closure $destination
* @return \Closure
*/
protected function prepareDestination(Closure $destination)
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
<?php
namespace App\Http\Middleware;
use App\ONE\LogsOne;
use Closure;
use Illuminate\Http\Request;
use Spatie\HttpLogger\LogWriter;
use Spatie\HttpLogger\LogProfile;
class LogsOneHandler
{
public function handle(Request $request, Closure $next)
{
// Log all requests
\App\ONE\LogsOne::access();
return $next($request);
}
public function terminate($request, $response)
{
\App\ONE\LogsOne::performance(LARAVEL_START, microtime(true));
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1528 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
namespace App\Http\Middleware;
use App\Modules\Cms\Models\Language;
use Closure;
class HttpsProtocol {
public function handle($request, Closure $next)
{
$languages = Language::whereActive(true)->get();
$supportedLocales = app('laravellocalization')->getSupportedLocales();
if (!empty($currentLocale = $request->segment(1, null)) || array_key_exists($currentLocale, $supportedLocales) || !$languages->where('code', $currentLocale)->isEmpty()) {
if (!$request->secure()) {
return redirect()->secure($request->getRequestUri());
}
}
return $next($request);
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1533 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
<?php
namespace App\Http\Middleware;
use Closure;
class ETagMiddleware
{
/**
* Implement Etag support
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// Get response
$response = $next($request);
// If this was a GET request...
if ($request->isMethod('get')) {
// Generate Etag
$etag = md5($response->getContent());
$requestEtag = str_replace('"', '', $request->getETags());
// Check to see if Etag has changed
if($requestEtag && $requestEtag[0] == $etag) {
$response->setNotModified();
}
// Set Etag
$response->setEtag($etag);
}
// Send response
return $response;
}
}
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1555 …4}
return $this->handleException($passable, new FatalThrowableError($e));
}
};
}
/**
* Get a Closure that represents a slice of the application onion.
*
* @return \Closure
*/
protected function carry()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
$callable = $slice($stack, $pipe);
return $callable($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
};
}
/**
* Handle the given exception.
*
* @param mixed $passable
* @param \Exception $e
* @return mixed
*
* @throws \Exception
*/
protected function handleException($passable, Exception $e)
{
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
{
$this->config = $config;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$request::setTrustedProxies([], $this->getTrustedHeaderNames()); // Reset trusted proxies between requests
$this->setTrustedProxyIpAddresses($request);
return $next($request);
}
/**
* Sets the trusted proxies on the request to the value of trustedproxy.proxies
*
* @param \Illuminate\Http\Request $request
*/
protected function setTrustedProxyIpAddresses(Request $request)
{
$trustedIps = $this->proxies ?: $this->config->get('trustedproxy.proxies');
// Trust any IP address that calls us
// `**` for backwards compatibility, but is deprecated
if ($trustedIps === '*' || $trustedIps === '**') {
return $this->setTrustedProxyIpAddressesToTheCallingIp($request);
}
// Support IPs addresses separated by comma
$trustedIps = is_string($trustedIps) ? array_map('trim', explode(',', $trustedIps)) : $trustedIps;
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
// the appropriate method and arguments, returning the results back out.
return $pipe($passable, $stack);
} elseif (! is_object($pipe)) {
[$name, $parameters] = $this->parsePipeString($pipe);
// If the pipe is a string we will parse the string and resolve the class out
// of the dependency injection container. We can then build a callable and
// execute the pipe function giving in the parameters that are required.
$pipe = $this->getContainer()->make($name);
$parameters = array_merge([$passable, $stack], $parameters);
} else {
// If the pipe is already an object we'll just make a callable and pass it to
// the pipe as-is. There is no need to do any extra parsing and formatting
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$response = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $response instanceof Responsable
? $response->toResponse($this->getContainer()->make(Request::class))
: $response;
};
};
}
/**
* Parse full pipe string to get name and parameters.
*
* @param string $pipe
* @return array
*/
protected function parsePipeString($pipe)
{
[$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
if (is_string($parameters)) {
Illuminate\Http\Request {#43 #json: null #convertedFiles: null #userResolver: Closure($guard = null) {#1587 …4} #routeResolver: Closure() {#1661 …4} +attributes: Symfony\Component\HttpFoundation\ParameterBag {#45} +request: Symfony\Component\HttpFoundation\ParameterBag {#51} +query: Symfony\Component\HttpFoundation\ParameterBag {#51} +server: Symfony\Component\HttpFoundation\ServerBag {#47} +files: Symfony\Component\HttpFoundation\FileBag {#48} +cookies: Symfony\Component\HttpFoundation\ParameterBag {#46} +headers: Symfony\Component\HttpFoundation\HeaderBag {#49} #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: array:1 [ 0 => "*/*" ] #pathInfo: "/en/quinta-de-honor" #requestUri: "/en/quinta-de-honor" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Illuminate\Session\Store {#1591} #locale: null #defaultLocale: "en" -preferredFormat: null -isHostValid: true -isForwardedValid: true : "" : "html" }
Closure($passable) {#1556 …4}
403 Forbidden Forbidden
You don't have permission to access this resource.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.