$basePath = '', $shouldCache = true, $compiledExtension = 'php') { if (! $cachePath) { throw new InvalidArgumentException('Please provide a valid cache path.'); } $this->files = $files; $this->cachePath = $cachePath; $this->basePath = $basePath; * @return void */ public function registerBladeCompiler() { $this->app->singleton('blade.compiler', function ($app) { return tap(new BladeCompiler( $app['files'], $app['config']['view.compiled'], $app['config']->get('view.relative_hash', false) ? $app->basePath() : '', $app['config']->get('view.cache', true), $app['config']->get('view.compiled_extension', 'php'), { // If the concrete type is actually a Closure, we will just execute it and // hand back the results of the functions, which allows functions to be // used as resolvers for more fine-tuned resolution of these objects. if ($concrete instanceof Closure) { return $concrete($this, $this->getLastParameterOverride()); } try { $reflector = new ReflectionClass($concrete); } catch (ReflectionException $e) { // We're ready to instantiate an instance of the concrete type registered for // the binding. This will instantiate the types, as well as resolve any of // its "nested" dependencies recursively until all have gotten resolved. $object = $this->isBuildable($concrete, $abstract) ? $this->build($concrete) : $this->make($concrete); // If we defined any extenders for this type, we'll need to spin through them // and apply them to the object being built. This allows for the extension // of services, such as changing configuration or decorating the object. */ protected function resolve($abstract, $parameters = [], $raiseEvents = true) { $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); return parent::resolve($abstract, $parameters, $raiseEvents); } /** * Load the deferred provider if the given type is a deferred service and the instance has not been loaded. * * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function make($abstract, array $parameters = []) { return $this->resolve($abstract, $parameters); } /** * {@inheritdoc} * */ public function make($abstract, array $parameters = []) { $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); return parent::make($abstract, $parameters); } /** * Resolve the given type from the container. * { $resolver->register('blade', function () { $app = Container::getInstance(); $compiler = new CompilerEngine( $app->make('blade.compiler'), $app->make('files'), ); $app->terminating(static function () use ($compiler) { $compiler->forgetCompiledOrNotExpired(); if (isset($this->resolved[$engine])) { return $this->resolved[$engine]; } if (isset($this->resolvers[$engine])) { return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]); } throw new InvalidArgumentException("Engine [{$engine}] not found."); } throw new InvalidArgumentException("Unrecognized extension in file: {$path}."); } $engine = $this->extensions[$extension]; return $this->engines->resolve($engine); } /** * Get the extension used by the view file. * * @param \Illuminate\Contracts\Support\Arrayable|array $data * @return \Illuminate\Contracts\View\View */ protected function viewInstance($view, $path, $data) { return new View($this, $this->getEngineFromPath($path), $view, $path, $data); } /** * Determine if a given view exists. * // Next, we will create the view instance and call the view creator for the view // which can set any data, etc. Then we will return the view instance back to // the caller for rendering or performing other view manipulations on this. $data = array_merge($mergeData, $this->parseData($data)); return tap($this->viewInstance($view, $path, $data), function ($view) { $this->callCreator($view); }); } /** { 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. * { $this->registerErrorViewPaths(); if ($view = $this->getHttpExceptionView($e)) { try { return response()->view($view, [ 'errors' => new ViewErrorBag, 'exception' => $e, ], $e->getStatusCode(), $e->getHeaders()); } catch (Throwable $t) { config('app.debug') && throw $t; if (! $this->isHttpException($e)) { $e = new HttpException(500, $e->getMessage(), $e); } return $this->toIlluminateResponse( $this->renderHttpException($e), $e )->prepare($request); } /** * Create a Symfony response for the given exception. */ protected function renderExceptionResponse($request, Throwable $e) { return $this->shouldReturnJson($request, $e) ? $this->prepareJsonResponse($request, $e) : $this->prepareResponse($request, $e); } /** * Convert an authentication exception into a response. * return match (true) { $e instanceof HttpResponseException => $e->getResponse(), $e instanceof AuthenticationException => $this->unauthenticated($request, $e), $e instanceof ValidationException => $this->convertValidationExceptionToResponse($e, $request), default => $this->renderExceptionResponse($request, $e), }; } /** * Prepare exception for rendering. $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. * if ($callback($request)) { return $next($request); } } return parent::handle($request, $next); } /** * Transform the given value. * // 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. * if ($callback($request)) { return $next($request); } } return parent::handle($request, $next); } /** * Transform the given value. * // 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); null, $this->getHeaders($data) ); } return $next($request); } /** * Determine if the incoming request has a maintenance mode bypass cookie. * // 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); * @return \Illuminate\Http\Response */ public function handle($request, Closure $next) { if (! $this->hasMatchingPath($request)) { return $next($request); } $this->cors->setOptions($this->container['config']->get('cors', [])); if ($this->cors->isPreflightRequest($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); { $request::setTrustedProxies([], $this->getTrustedHeaderNames()); $this->setTrustedProxyIpAddresses($request); return $next($request); } /** * Sets the trusted proxies on the 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); { $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. * $this->requestStartedAt = Carbon::now(); try { $request->enableHttpMethodParameterOverride(); $response = $this->sendRequestThroughRouter($request); } catch (Throwable $e) { $this->reportException($e); $response = $this->renderException($request, $e); }$app = require_once __DIR__.'/../bootstrap/app.php';$kernel = $app->make(Kernel::class);$response = $kernel->handle( $request = Request::capture())->send();$kernel->terminate($request, $response);|
InvalidArgumentException
|
|---|
InvalidArgumentException:
Please provide a valid cache path.
at /var/www/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:67
at Illuminate\View\Compilers\Compiler->__construct(object(Filesystem), false, '', true, 'php')
(/var/www/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php:97)
at Illuminate\View\ViewServiceProvider->Illuminate\View\{closure}(object(Application), array())
(/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:908)
at Illuminate\Container\Container->build(object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:795)
at Illuminate\Container\Container->resolve('blade.compiler', array(), true)
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:961)
at Illuminate\Foundation\Application->resolve('blade.compiler', array())
(/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:731)
at Illuminate\Container\Container->make('blade.compiler', array())
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:946)
at Illuminate\Foundation\Application->make('blade.compiler')
(/var/www/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php:168)
at Illuminate\View\ViewServiceProvider->Illuminate\View\{closure}()
at call_user_func(object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php:55)
at Illuminate\View\Engines\EngineResolver->resolve('blade')
(/var/www/vendor/laravel/framework/src/Illuminate/View/Factory.php:310)
at Illuminate\View\Factory->getEngineFromPath('/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php')
(/var/www/vendor/laravel/framework/src/Illuminate/View/Factory.php:274)
at Illuminate\View\Factory->viewInstance('errors::404', '/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php', array('errors' => object(ViewErrorBag), 'exception' => object(NotFoundHttpException)))
(/var/www/vendor/laravel/framework/src/Illuminate/View/Factory.php:146)
at Illuminate\View\Factory->make('errors::404', array('errors' => object(ViewErrorBag), 'exception' => object(NotFoundHttpException)))
(/var/www/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php:88)
at Illuminate\Routing\ResponseFactory->view('errors::404', array('errors' => object(ViewErrorBag), 'exception' => object(NotFoundHttpException)), 404, array())
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:723)
at Illuminate\Foundation\Exceptions\Handler->renderHttpException(object(NotFoundHttpException))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:650)
at Illuminate\Foundation\Exceptions\Handler->prepareResponse(object(Request), object(NotFoundHttpException))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:556)
at Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse(object(Request), object(NotFoundHttpException))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:473)
at Illuminate\Foundation\Exceptions\Handler->render(object(Request), object(NotFoundHttpException))
(/var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:51)
at Illuminate\Routing\Pipeline->handleException(object(Request), object(NotFoundHttpException))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:146)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)
at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40)
at Illuminate\Foundation\Http\Middleware\TrimStrings->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)
at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:99)
at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:49)
at Illuminate\Http\Middleware\HandleCors->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39)
at Illuminate\Http\Middleware\TrustProxies->handle(object(Request), object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119)
at Illuminate\Pipeline\Pipeline->then(object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:175)
at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:144)
at Illuminate\Foundation\Http\Kernel->handle(object(Request))
(/var/www/public/index.php:51)
|