Illuminate\View\ViewException {#1322 #severity: E_ERROR }
throw new UniqueConstraintViolationException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } throw new QueryException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } } \Illuminate\View\Engines\PhpEngine::handleViewException($e, $obLevel); return; } parent::handleViewException($e, $obLevel); } public function shouldBypassExceptionForLivewire(\Throwable $e, $obLevel) { $uses = array_flip(class_uses_recursive($e)); \Closure::bind(function () use ($__path, $__data) { extract($__data, EXTR_SKIP); include $__path; }, $component, $component)(); } catch (\Exception|\Throwable $e) { $this->handleViewException($e, $obLevel); } return ltrim(ob_get_clean()); } // Once we have the path to the compiled file, we will evaluate the paths with // typical PHP just like any other templates. We also keep a stack of views // which have been rendered for right exception messages to be generated. try { $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data); } catch (ViewException $e) { if (! Str::of($e->getMessage())->contains(['No such file or directory', 'File does not exist at path'])) { throw $e; } $currentComponent = ExtendBlade::currentRendering(); trigger('view:compile', $currentComponent, $path); return parent::get($path, $data); } protected function evaluatePath($__path, $__data) { if (! ExtendBlade::isRenderingLivewireComponent()) { * * @return string */ protected function getContents() { return $this->engine->get($this->path, $this->gatherData()); } /** * Get the data bound to the view instance. * // 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 section gets flushed out next time a view is created and // no old sections are staying around in the memory of an environment. $this->factory->decrementRender(); * @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 $revertA = Utils::shareWithViews('__livewire', $component); $revertB = Utils::shareWithViews('_instance', $component); // @deprecated $viewContext = new ViewContext; $html = $view->render(function ($view) use ($viewContext) { // Extract leftover slots, sections, and pushes before they get flushed... $viewContext->extractFromEnvironment($view->getFactory()); }); $revertA(); $revertB(); protected function trackInRenderStack($component, $callback) { array_push(static::$renderStack, $component); return tap($callback(), function () { array_pop(static::$renderStack); }); } protected function updateProperties($component, $updates, $data, $context) ]); } [ $view, $properties ] = $this->getView($component); return $this->trackInRenderStack($component, function () use ($component, $view, $properties) { $finish = trigger('render', $component, $view, $properties); $revertA = Utils::shareWithViews('__livewire', $component); $revertB = Utils::shareWithViews('_instance', $component); // @deprecated if (config('app.debug')) $start = microtime(true); $finish = trigger('mount', $component, $params, $key, $parent); if (config('app.debug')) trigger('profile', 'mount', $component->getId(), [$start, microtime(true)]); if (config('app.debug')) $start = microtime(true); $html = $this->render($component, '<div></div>'); if (config('app.debug')) trigger('profile', 'render', $component->getId(), [$start, microtime(true)]); if (config('app.debug')) $start = microtime(true); trigger('dehydrate', $component, $context); return app(ComponentRegistry::class)->resolveMissingComponent($resolver); } function mount($name, $params = [], $key = null) { return app(HandleComponents::class)->mount($name, $params, $key); } function snapshot($component, $context = null) { return app(HandleComponents::class)->snapshot($component, $context); $html = null; $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) { $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this); $html = app('livewire')->mount($this::class, $params); }); $layoutConfig = $layoutConfig ?: new PageComponentConfig; $layoutConfig->normalizeViewNameAndParamsForBladeComponents(); }); on('render', $handler); on('render.placeholder', $handler); $callback(); off('render', $handler); off('render.placeholder', $handler); return $layoutConfig; // Here's we're hooking into the "__invoke" method being called on a component. // This way, users can pass Livewire components into Routes as if they were // simple invokable controllers. Ex: Route::get('...', SomeLivewireComponent::class); $html = null; $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) { $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this); $html = app('livewire')->mount($this::class, $params); }); if (method_exists($controller, 'callAction')) { return $controller->callAction($method, $parameters); } return $controller->{$method}(...array_values($parameters)); } /** * Resolve the parameters for the controller. * * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ protected function runController() { return $this->controllerDispatcher()->dispatch( $this, $this->getController(), $this->getControllerMethod() ); } /** { $this->container = $this->container ?: new Container; try { if ($this->isControllerAction()) { return $this->runController(); } return $this->runCallable(); } catch (HttpResponseException $e) { return $e->getResponse(); return (new Pipeline($this->container)) ->send($request) ->through($middleware) ->then(fn ($request) => $this->prepareResponse( $request, $route->run() )); } /** * Gather the middleware for the given route with resolved class names. */ protected function prepareDestination(Closure $destination) { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } $footer_header=PageContent::whereIN('page', ['footer','header']) ->where('locale', app()->getLocale()) ->pluck('value', 'key') ->toArray(); View::share('footer_header', $footer_header); return $next($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); App::setLocale($locale); // dd(0); // return redirect($locale . '/' . $request->path()); } return $next($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); } throw $exception; } return $next($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); $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); } }); } // 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); // 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); }} // 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); $this->startSession($request, $session) ); $this->collectGarbage($session); $response = $next($request); $this->storeCurrentUrl($request, $session); $this->addCookieToResponse($response, $session); if ($this->manager->shouldBlock() || ($request->route() instanceof Route && $request->route()->locksFor())) { return $this->handleRequestWhileBlocking($request, $session, $next); } return $this->handleStatefulRequest($request, $session, $next); } /** * Handle the given request within session state. * // 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); * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); foreach ($this->cookies->getQueuedCookies() as $cookie) { $response->headers->setCookie($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); * @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. * // 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) ); try { return $pipeline($this->passable); } finally { if ($this->finally) { ($this->finally)($this->passable); } } $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); return (new Pipeline($this->container)) ->send($request) ->through($middleware) ->then(fn ($request) => $this->prepareResponse( $request, $route->run() )); } /** $request->setRouteResolver(fn () => $route); $this->events->dispatch(new RouteMatched($route, $request)); return $this->prepareResponse($request, $this->runRouteWithinStack($route, $request) ); } /** * Run the given route within a Stack "onion" instance. * @param \Illuminate\Http\Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function dispatchToRoute(Request $request) { return $this->runRoute($request, $this->findRoute($request)); } /** * Find the route matching a given request. * */ public function dispatch(Request $request) { $this->currentRequest = $request; return $this->dispatchToRoute($request); } /** * Dispatch the request to a route and return the response. * protected function dispatchToRouter() { return function ($request) { $this->app->instance('request', $request); return $this->router->dispatch($request); }; } /** * Call the terminate method on any terminable middleware. */ protected function prepareDestination(Closure $destination) { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); if ($response instanceof Response && SupportDisablingBackButtonCache::$disableBackButtonCache){ $response->headers->add([ 'Pragma' => 'no-cache', 'Expires' => 'Fri, 01 Jan 1990 00:00:00 GMT', // 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); */ 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('The POST data is too large.'); } 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); * @param \Closure $next * @return \Symfony\Component\HttpFoundation\Response */ public function handle(Request $request, Closure $next) { return $next($request); } /** * Invoke the deferred callbacks. * // 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) ); try { return $pipeline($this->passable); } finally { if ($this->finally) { ($this->finally)($this->passable); } } $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); } */ public function handleRequest(Request $request) { $kernel = $this->make(HttpKernelContract::class); $response = $kernel->handle($request)->send(); $kernel->terminate($request, $response); } /**// Register the Composer autoloader...require __DIR__.'/../vendor/autoload.php';// Bootstrap Laravel and handle the request...(require_once __DIR__.'/../bootstrap/app.php') ->handleRequest(Request::capture()); throw new UniqueConstraintViolationException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } throw new QueryException( $this->getName(), $query, $this->prepareBindings($bindings), $e ); } } protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) { if ($this->causedByLostConnection($e->getPrevious())) { $this->reconnect(); return $this->runQueryCallback($query, $bindings, $callback); } throw $e; } { if ($this->transactions >= 1) { throw $e; } return $this->tryAgainIfCausedByLostConnection( $e, $query, $bindings, $callback ); } /** // caused by a connection that has been lost. If that is the cause, we'll try // to re-establish connection and re-run the query with a fresh connection. try { $result = $this->runQueryCallback($query, $bindings, $callback); } catch (QueryException $e) { $result = $this->handleQueryException( $e, $query, $bindings, $callback ); } // Once we have run the query we will calculate the time that it took to run and * @param bool $useReadPdo * @return array */ public function select($query, $bindings = [], $useReadPdo = true) { return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { if ($this->pretending()) { return []; } // For select statements, we'll simply execute the query and return an array * * @return array */ protected function runSelect() { return $this->connection->select( $this->toSql(), $this->getBindings(), ! $this->useWritePdo ); } /** * @return \Illuminate\Support\Collection<int, \stdClass> */ public function get($columns = ['*']) { $items = new Collection($this->onceWithColumns(Arr::wrap($columns), function () { return $this->processor->processSelect($this, $this->runSelect()); })); return $this->applyAfterQueryCallbacks( isset($this->groupLimit) ? $this->withoutGroupLimitKeys($items) : $items ); if (is_null($original)) { $this->columns = $columns; } $result = $callback(); $this->columns = $original; return $result; } * @param array|string $columns * @return \Illuminate\Support\Collection<int, \stdClass> */ public function get($columns = ['*']) { $items = new Collection($this->onceWithColumns(Arr::wrap($columns), function () { return $this->processor->processSelect($this, $this->runSelect()); })); return $this->applyAfterQueryCallbacks( isset($this->groupLimit) ? $this->withoutGroupLimitKeys($items) : $items * @return array<int, TModel> */ public function getModels($columns = ['*']) { return $this->model->hydrate( $this->query->get($columns)->all() )->all(); } /** * Eager load the relationships for the models. $builder = $this->applyScopes(); // If we actually found models we will also eager load any relationships that // have been specified as needing to be eager loaded, which will solve the // n+1 query issue for the developers to avoid running a lot of queries. if (count($models = $builder->getModels($columns)) > 0) { $models = $builder->eagerLoadRelations($models); } return $this->applyAfterQueryCallbacks( $builder->getModel()->newCollection($models) /** @inheritDoc */ public function getResults() { return ! is_null($this->getParentKey()) ? $this->query->get() : $this->related->newCollection(); } /** @inheritDoc */ public function initRelation(array $models, $relation) throw new LogicException(sprintf( '%s::%s must return a relationship instance.', static::class, $method )); } return tap($relation->getResults(), function ($results) use ($method) { $this->setRelation($method, $results); }); } /** } // If the "attribute" exists as a method on the model, we will just assume // it is a relationship and will load and return results from the query // and hydrate the relationship's value on the "relationships" array. return $this->getRelationshipFromMethod($key); } /** * Determine if the given key is a relationship method on the model. * if (method_exists(self::class, $key)) { return $this->throwMissingAttributeExceptionIfApplicable($key); } return $this->isRelation($key) || $this->relationLoaded($key) ? $this->getRelationValue($key) : $this->throwMissingAttributeExceptionIfApplicable($key); } /** * Either throw a missing attribute exception or return null depending on Eloquent's configuration. } return $this->getAttributeOrFallback($locale, $attribute); } return parent::getAttribute($key); } public function getDefaultLocale(): ?string { return $this->defaultLocale; * @param string $key * @return mixed */ public function __get($key) { return $this->getAttribute($key); } /** * Dynamically set attributes on the model. * && $this->translation->getAttribute($this->getLocaleKey()) == $key ) { return $this->translation; } return $this->translations->firstWhere($this->getLocaleKey(), $key); } protected function toArrayAlwaysLoadsTranslations(): bool { return config('translatable.to_array_always_loads_translations', true); $configFallbackLocale = $this->getFallbackLocale(); $locale = $locale ?: $this->locale(); $withFallback = $withFallback === null ? $this->useFallback() : $withFallback; $fallbackLocale = $this->getFallbackLocale($locale); if ($translation = $this->getTranslationByLocaleKey($locale)) { return $translation; } if ($withFallback && $fallbackLocale) { if ($translation = $this->getTranslationByLocaleKey($fallbackLocale)) { public function getAttribute($key) { [$attribute, $locale] = $this->getAttributeAndLocale($key); if ($this->isTranslationAttribute($attribute)) { if ($this->getTranslation($locale) === null) { return $this->getAttributeValue($attribute); } // If the given $attribute has a mutator, we push it to $attributes and then call getAttributeValue // on it. This way, we can use Eloquent's checking for Mutation, type casting, and * @param string $key * @return mixed */ public function __get($key) { return $this->getAttribute($key); } /** * Dynamically set attributes on the model. *</div><div class="row g-5 mt--30"><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $services; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $service): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="col-lg-3 col-md-4 col-sm-6 col-12"><!-- single course category --><a href="/<?php echo e(app()->getLocale()); ?>/services/<?php echo e($service->id); ?>/<?php echo e($service->name); ?>"class="single-category-2"><img src="<?php echo e(Storage::url($service->icon)); ?>" alt="<?php echo e($service->name); ?>"style="width: 100%; try { $component = ExtendBlade::currentRendering(); \Closure::bind(function () use ($__path, $__data) { extract($__data, EXTR_SKIP); include $__path; }, $component, $component)(); } catch (\Exception|\Throwable $e) { $this->handleViewException($e, $obLevel); } $component = ExtendBlade::currentRendering(); \Closure::bind(function () use ($__path, $__data) { extract($__data, EXTR_SKIP); include $__path; }, $component, $component)(); } catch (\Exception|\Throwable $e) { $this->handleViewException($e, $obLevel); } return ltrim(ob_get_clean()); // Once we have the path to the compiled file, we will evaluate the paths with // typical PHP just like any other templates. We also keep a stack of views // which have been rendered for right exception messages to be generated. try { $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data); } catch (ViewException $e) { if (! Str::of($e->getMessage())->contains(['No such file or directory', 'File does not exist at path'])) { throw $e; } $currentComponent = ExtendBlade::currentRendering(); trigger('view:compile', $currentComponent, $path); return parent::get($path, $data); } protected function evaluatePath($__path, $__data) { if (! ExtendBlade::isRenderingLivewireComponent()) { * * @return string */ protected function getContents() { return $this->engine->get($this->path, $this->gatherData()); } /** * Get the data bound to the view instance. * // 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 section gets flushed out next time a view is created and // no old sections are staying around in the memory of an environment. $this->factory->decrementRender(); * @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 $revertA = Utils::shareWithViews('__livewire', $component); $revertB = Utils::shareWithViews('_instance', $component); // @deprecated $viewContext = new ViewContext; $html = $view->render(function ($view) use ($viewContext) { // Extract leftover slots, sections, and pushes before they get flushed... $viewContext->extractFromEnvironment($view->getFactory()); }); $revertA(); $revertB(); protected function trackInRenderStack($component, $callback) { array_push(static::$renderStack, $component); return tap($callback(), function () { array_pop(static::$renderStack); }); } protected function updateProperties($component, $updates, $data, $context) ]); } [ $view, $properties ] = $this->getView($component); return $this->trackInRenderStack($component, function () use ($component, $view, $properties) { $finish = trigger('render', $component, $view, $properties); $revertA = Utils::shareWithViews('__livewire', $component); $revertB = Utils::shareWithViews('_instance', $component); // @deprecated if (config('app.debug')) $start = microtime(true); $finish = trigger('mount', $component, $params, $key, $parent); if (config('app.debug')) trigger('profile', 'mount', $component->getId(), [$start, microtime(true)]); if (config('app.debug')) $start = microtime(true); $html = $this->render($component, '<div></div>'); if (config('app.debug')) trigger('profile', 'render', $component->getId(), [$start, microtime(true)]); if (config('app.debug')) $start = microtime(true); trigger('dehydrate', $component, $context); return app(ComponentRegistry::class)->resolveMissingComponent($resolver); } function mount($name, $params = [], $key = null) { return app(HandleComponents::class)->mount($name, $params, $key); } function snapshot($component, $context = null) { return app(HandleComponents::class)->snapshot($component, $context); $html = null; $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) { $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this); $html = app('livewire')->mount($this::class, $params); }); $layoutConfig = $layoutConfig ?: new PageComponentConfig; $layoutConfig->normalizeViewNameAndParamsForBladeComponents(); }); on('render', $handler); on('render.placeholder', $handler); $callback(); off('render', $handler); off('render.placeholder', $handler); return $layoutConfig; // Here's we're hooking into the "__invoke" method being called on a component. // This way, users can pass Livewire components into Routes as if they were // simple invokable controllers. Ex: Route::get('...', SomeLivewireComponent::class); $html = null; $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) { $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this); $html = app('livewire')->mount($this::class, $params); }); if (method_exists($controller, 'callAction')) { return $controller->callAction($method, $parameters); } return $controller->{$method}(...array_values($parameters)); } /** * Resolve the parameters for the controller. * * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ protected function runController() { return $this->controllerDispatcher()->dispatch( $this, $this->getController(), $this->getControllerMethod() ); } /** { $this->container = $this->container ?: new Container; try { if ($this->isControllerAction()) { return $this->runController(); } return $this->runCallable(); } catch (HttpResponseException $e) { return $e->getResponse(); return (new Pipeline($this->container)) ->send($request) ->through($middleware) ->then(fn ($request) => $this->prepareResponse( $request, $route->run() )); } /** * Gather the middleware for the given route with resolved class names. */ protected function prepareDestination(Closure $destination) { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } $footer_header=PageContent::whereIN('page', ['footer','header']) ->where('locale', app()->getLocale()) ->pluck('value', 'key') ->toArray(); View::share('footer_header', $footer_header); return $next($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); App::setLocale($locale); // dd(0); // return redirect($locale . '/' . $request->path()); } return $next($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); } throw $exception; } return $next($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); $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); } }); } // 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); // 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); }} // 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); $this->startSession($request, $session) ); $this->collectGarbage($session); $response = $next($request); $this->storeCurrentUrl($request, $session); $this->addCookieToResponse($response, $session); if ($this->manager->shouldBlock() || ($request->route() instanceof Route && $request->route()->locksFor())) { return $this->handleRequestWhileBlocking($request, $session, $next); } return $this->handleStatefulRequest($request, $session, $next); } /** * Handle the given request within session state. * // 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); * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); foreach ($this->cookies->getQueuedCookies() as $cookie) { $response->headers->setCookie($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); * @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. * // 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) ); try { return $pipeline($this->passable); } finally { if ($this->finally) { ($this->finally)($this->passable); } } $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); return (new Pipeline($this->container)) ->send($request) ->through($middleware) ->then(fn ($request) => $this->prepareResponse( $request, $route->run() )); } /** $request->setRouteResolver(fn () => $route); $this->events->dispatch(new RouteMatched($route, $request)); return $this->prepareResponse($request, $this->runRouteWithinStack($route, $request) ); } /** * Run the given route within a Stack "onion" instance. * @param \Illuminate\Http\Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function dispatchToRoute(Request $request) { return $this->runRoute($request, $this->findRoute($request)); } /** * Find the route matching a given request. * */ public function dispatch(Request $request) { $this->currentRequest = $request; return $this->dispatchToRoute($request); } /** * Dispatch the request to a route and return the response. * protected function dispatchToRouter() { return function ($request) { $this->app->instance('request', $request); return $this->router->dispatch($request); }; } /** * Call the terminate method on any terminable middleware. */ protected function prepareDestination(Closure $destination) { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); if ($response instanceof Response && SupportDisablingBackButtonCache::$disableBackButtonCache){ $response->headers->add([ 'Pragma' => 'no-cache', 'Expires' => 'Fri, 01 Jan 1990 00:00:00 GMT', // 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); */ 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('The POST data is too large.'); } 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); * @param \Closure $next * @return \Symfony\Component\HttpFoundation\Response */ public function handle(Request $request, Closure $next) { return $next($request); } /** * Invoke the deferred callbacks. * // 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) ); try { return $pipeline($this->passable); } finally { if ($this->finally) { ($this->finally)($this->passable); } } $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); } */ public function handleRequest(Request $request) { $kernel = $this->make(HttpKernelContract::class); $response = $kernel->handle($request)->send(); $kernel->terminate($request, $response); } /**// Register the Composer autoloader...require __DIR__.'/../vendor/autoload.php';// Bootstrap Laravel and handle the request...(require_once __DIR__.'/../bootstrap/app.php') ->handleRequest(Request::capture()); * @return \PDO */ protected function createPdoConnection($dsn, $username, #[\SensitiveParameter] $password, $options) { return version_compare(phpversion(), '8.4.0', '<') ? new PDO($dsn, $username, $password, $options) : PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */ } /** * Handle an exception that occurred during connect execution. * @return \PDO */ protected function createPdoConnection($dsn, $username, #[\SensitiveParameter] $password, $options) { return version_compare(phpversion(), '8.4.0', '<') ? new PDO($dsn, $username, $password, $options) : PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */ } /** * Handle an exception that occurred during connect execution. [$username, $password] = [ $config['username'] ?? null, $config['password'] ?? null, ]; try { return $this->createPdoConnection( $dsn, $username, $password, $options ); } catch (Exception $e) { return $this->tryAgainIfCausedByLostConnection( $e, $dsn, $username, $password, $options */ public function connect(array $config) { $options = $this->getOptions($config); $connection = $this->createConnection($this->getDsn($config), $config, $options); $this->configureIsolationLevel($connection, $config); return $connection; } return function () use ($config) { foreach (Arr::shuffle($this->parseHosts($config)) as $host) { $config['host'] = $host; try { return $this->createConnector($config)->connect($config); } catch (PDOException $e) { continue; } } * @return \PDO */ public function getPdo() { if ($this->pdo instanceof Closure) { return $this->pdo = call_user_func($this->pdo); } return $this->pdo; } if ($this->readPdo instanceof Closure) { return $this->readPdo = call_user_func($this->readPdo); } return $this->readPdo ?: $this->getPdo(); } /** * Get the current read PDO connection parameter without executing any reconnect logic. * * @param bool $useReadPdo * @return \PDO */ protected function getPdoForSelect($useReadPdo = true) { return $useReadPdo ? $this->getReadPdo() : $this->getPdo(); } /** * Run an insert statement against the database. * // For select statements, we'll simply execute the query and return an array // of the database result set. Each element in the array will be a single // row from the database table, and will either be an array or objects. $statement = $this->prepared( $this->getPdoForSelect($useReadPdo)->prepare($query) ); $this->bindValues($statement, $this->prepareBindings($bindings)); $statement->execute(); { // To execute the statement, we'll simply call the callback, which will actually // run the SQL against the PDO connection. Then we can calculate the time it // took to execute and log the query SQL, bindings and time in our memory. try { return $callback($query, $bindings); } // If an exception occurs when attempting to run a query, we'll format the error // message to include the bindings with SQL, which will make this exception a // lot more helpful to the developer instead of just the database's errors. protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) { if ($this->causedByLostConnection($e->getPrevious())) { $this->reconnect(); return $this->runQueryCallback($query, $bindings, $callback); } throw $e; } { if ($this->transactions >= 1) { throw $e; } return $this->tryAgainIfCausedByLostConnection( $e, $query, $bindings, $callback ); } /**<?php
namespace Illuminate\Database;
use Carbon\CarbonInterval;
use Closure;
use DateTimeInterface;
use Exception;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Database\Events\StatementPrepared;
use Illuminate\Database\Events\TransactionBeginning;
use Illuminate\Database\Events\TransactionCommitted;
use Illuminate\Database\Events\TransactionCommitting;
use Illuminate\Database\Events\TransactionRolledBack;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Query\Grammars\Grammar as QueryGrammar;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Database\Schema\Builder as SchemaBuilder;
use Illuminate\Support\Arr;
use Illuminate\Support\InteractsWithTime;
use Illuminate\Support\Traits\Macroable;
use PDO;
use PDOStatement;
use RuntimeException;
class Connection implements ConnectionInterface
{
use DetectsConcurrencyErrors,
DetectsLostConnections,
Concerns\ManagesTransactions,
InteractsWithTime,
Macroable;
/**
* The active PDO connection.
*
* @var \PDO|\Closure
*/
protected $pdo;
/**
* The active PDO connection used for reads.
*
* @var \PDO|\Closure
*/
protected $readPdo;
/**
* The name of the connected database.
*
* @var string
*/
protected $database;
/**
* The type of the connection.
*
* @var string|null
*/
protected $readWriteType;
/**
* The table prefix for the connection.
*
* @var string
*/
protected $tablePrefix = '';
/**
* The database connection configuration options.
*
* @var array
*/
protected $config = [];
/**
* The reconnector instance for the connection.
*
* @var