* @param View $view
* @return void
*/
public function compose(View $view)
{
$brand = Brand::where('name', request()->route()->parameter('brand'))->first();
$header_links = $brand->locations()->where('location', '1')->orderBy('order')->get();
$footer_links = $brand->locations()->where('location', '2')->orderBy('order')->get();
$bar_links = $brand->locations()->where('location', '3')->orderBy('order')->get();
$sitemap = $brand->categories()->with('links')->orderBy('order')->get();
// Once we have the class and method name, we can build the Closure to resolve
// the instance out of the IoC container and call the method on it with the
// given arguments that are passed to the Closure as the composer's data.
return function () use ($class, $method) {
return $this->container->make($class)->{$method}(...func_get_args());
};
}
/**
* Parse a class based composer name.
return function ($event, $payload) use ($listener, $wildcard) {
if ($wildcard) {
return $listener($event, $payload);
}
return $listener(...array_values($payload));
};
}
/**
* Create a class based listener using the IoC container.
}
$responses = [];
foreach ($this->getListeners($event) as $listener) {
$response = $listener($event, $payload);
// If a response is returned from the listener and event halting is enabled
// we will just return this response, and not call the rest of the event
// listeners. Otherwise we will add the response on the response list.
if ($halt && ! is_null($response)) {
* @param \Illuminate\Contracts\View\View $view
* @return void
*/
public function callComposer(ViewContract $view)
{
$this->events->dispatch('composing: '.$view->name(), [$view]);
}
/**
* Call the creator for a given view.
*
// We will keep track of the amount of views being rendered so we can flush
// the section after the complete rendering operation is done. This will
// clear out the sections for any separate views that may be rendered.
$this->factory->incrementRender();
$this->factory->callComposer($this);
$contents = $this->getContents();
// Once we've finished rendering the view, we'll decrement the render count
// so that each sections get flushed out next time a view is created and
* @throws \Throwable
*/
public function render(callable $callback = null)
{
try {
$contents = $this->renderContents();
$response = isset($callback) ? $callback($this, $contents) : null;
// Once we have the contents of the view, we will flush the sections if we are
// done rendering all views so that there is nothing left hanging over when
// If this content implements the "Renderable" interface then we will call the
// render method on the object so we will avoid any "__toString" exceptions
// that might be thrown and have their errors obscured by PHP's handling.
elseif ($content instanceof Renderable) {
$content = $content->render();
}
parent::setContent($content);
return $this;
*/
public function __construct($content = '', $status = 200, array $headers = [])
{
$this->headers = new ResponseHeaderBag($headers);
$this->setContent($content);
$this->setStatusCode($status);
$this->setProtocolVersion('1.0');
}
/**
* @param array $headers
* @return \Illuminate\Http\Response
*/
public function make($content = '', $status = 200, array $headers = [])
{
return new Response($content, $status, $headers);
}
/**
* Create a new "no content" response.
*
{
if (is_array($view)) {
return $this->make($this->view->first($view, $data), $status, $headers);
}
return $this->make($this->view->make($view, $data), $status, $headers);
}
/**
* Create a new JSON response instance.
*
if (view()->exists($view = $this->getHttpExceptionView($e))) {
return response()->view($view, [
'errors' => new ViewErrorBag,
'exception' => $e,
], $e->getStatusCode(), $e->getHeaders());
}
return $this->convertExceptionToResponse($e);
}
if (! $this->isHttpException($e)) {
$e = new HttpException(500, $e->getMessage());
}
return $this->toIlluminateResponse(
$this->renderHttpException($e), $e
);
}
/**
* Create a Symfony response for the given exception.
return $this->convertValidationExceptionToResponse($e, $request);
}
return $request->expectsJson()
? $this->prepareJsonResponse($request, $e)
: $this->prepareResponse($request, $e);
}
/**
* Prepare exception for rendering.
*
view()->share('error_brand', $brand);
}else if($request->is('*ds*')) {
$brand = Brand::where('slug', 'ds')->first();
view()->share('error_brand', $brand);
}
return parent::render($request, $exception);
}
}
$handler = $this->container->make(ExceptionHandler::class);
$handler->report($e);
$response = $handler->render($passable, $e);
if (is_object($response) && method_exists($response, 'withException')) {
$response->withException($e);
}
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
}
/**
*/
public function handle($request, Closure $next)
{
$this->clean($request);
return $next($request);
}
/**
* Clean the request's data.
*
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
*/
public function handle($request, Closure $next)
{
$this->clean($request);
return $next($request);
}
/**
* Clean the request's data.
*
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {
throw new PostTooLargeException;
}
return $next($request);
}
/**
* Determine the server 'post_max_size' as bytes.
*
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']);
}
return $next($request);
}
/**
* Determine if the request has a URI that should be accessible in maintenance mode.
*
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
*/
public function handle($request, Closure $next)
{
// Check if we're dealing with CORS and if we should handle it
if (! $this->shouldRun($request)) {
return $next($request);
}
// For Preflight, return the Preflight response
if ($this->cors->isPreflightRequest($request)) {
return $this->cors->handlePreflightRequest($request);
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
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
*
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
{
$pipeline = array_reduce(
array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
);
return $pipeline($this->passable);
}
/**
* Run the pipeline and return the result.
*
$this->bootstrap();
return (new Pipeline($this->app))
->send($request)
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
->then($this->dispatchToRouter());
}
/**
* Bootstrap the application for HTTP requests.
*
public function handle($request)
{
try {
$request->enableHttpMethodParameterOverride();
$response = $this->sendRequestThroughRouter($request);
} catch (Throwable $e) {
$this->reportException($e);
$response = $this->renderException($request, $e);
}
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
Error
|
---|
Error: Call to a member function parameter() on null at /mnt/data1/web/pcd-forms/app/Http/Composers/Error404Composer.php:26 at App\Http\Composers\Error404Composer->compose() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php:124) at Illuminate\View\Factory->Illuminate\View\Concerns\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:381) at Illuminate\Events\Dispatcher->Illuminate\Events\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:226) at Illuminate\Events\Dispatcher->dispatch() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php:177) at Illuminate\View\Factory->callComposer() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/View/View.php:120) at Illuminate\View\View->renderContents() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/View/View.php:91) at Illuminate\View\View->render() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Http/Response.php:62) at Illuminate\Http\Response->setContent() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Http/Response.php:34) at Illuminate\Http\Response->__construct() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php:55) at Illuminate\Routing\ResponseFactory->make() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php:85) at Illuminate\Routing\ResponseFactory->view() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:409) at Illuminate\Foundation\Exceptions\Handler->renderHttpException() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:314) at Illuminate\Foundation\Exceptions\Handler->prepareResponse() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:211) at Illuminate\Foundation\Exceptions\Handler->render() (/mnt/data1/web/pcd-forms/app/Exceptions/Handler.php:61) at App\Exceptions\Handler->render() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:51) at Illuminate\Routing\Pipeline->handleException() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:130) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21) at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21) at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27) at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:63) at Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/fruitcake/laravel-cors/src/HandleCors.php:37) at Fruitcake\Cors\HandleCors->handle() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/fideloper/proxy/src/TrustProxies.php:57) at Fideloper\Proxy\TrustProxies->handle() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103) at Illuminate\Pipeline\Pipeline->then() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:140) at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() (/mnt/data1/web/pcd-forms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:109) at Illuminate\Foundation\Http\Kernel->handle() (/mnt/data1/web/pcd-forms/public/index.php:55) |