Symfony Exception

PDOException QueryException ViewException

HTTP 500 Internal Server Error

SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server. (Connection: sqlsrv, SQL: select * from [service_translations] where [service_translations].[service_id] = 11 and [service_translations].[service_id] is not null) (View: /home/dwg-germany.de/dwg/resources/views/livewire/home.blade.php)

Exceptions 3

Illuminate\View\ ViewException

Show exception properties
Illuminate\View\ViewException {#1322
  #severity: E_ERROR
}
  1. throw new UniqueConstraintViolationException(
  2. $this->getName(), $query, $this->prepareBindings($bindings), $e
  3. );
  4. }
  5. throw new QueryException(
  6. $this->getName(), $query, $this->prepareBindings($bindings), $e
  7. );
  8. }
  9. }
  1. \Illuminate\View\Engines\PhpEngine::handleViewException($e, $obLevel);
  2. return;
  3. }
  4. parent::handleViewException($e, $obLevel);
  5. }
  6. public function shouldBypassExceptionForLivewire(\Throwable $e, $obLevel)
  7. {
  8. $uses = array_flip(class_uses_recursive($e));
  1. \Closure::bind(function () use ($__path, $__data) {
  2. extract($__data, EXTR_SKIP);
  3. include $__path;
  4. }, $component, $component)();
  5. } catch (\Exception|\Throwable $e) {
  6. $this->handleViewException($e, $obLevel);
  7. }
  8. return ltrim(ob_get_clean());
  9. }
  1. // Once we have the path to the compiled file, we will evaluate the paths with
  2. // typical PHP just like any other templates. We also keep a stack of views
  3. // which have been rendered for right exception messages to be generated.
  4. try {
  5. $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data);
  6. } catch (ViewException $e) {
  7. if (! Str::of($e->getMessage())->contains(['No such file or directory', 'File does not exist at path'])) {
  8. throw $e;
  9. }
  1. $currentComponent = ExtendBlade::currentRendering();
  2. trigger('view:compile', $currentComponent, $path);
  3. return parent::get($path, $data);
  4. }
  5. protected function evaluatePath($__path, $__data)
  6. {
  7. if (! ExtendBlade::isRenderingLivewireComponent()) {
  1. *
  2. * @return string
  3. */
  4. protected function getContents()
  5. {
  6. return $this->engine->get($this->path, $this->gatherData());
  7. }
  8. /**
  9. * Get the data bound to the view instance.
  10. *
  1. // clear out the sections for any separate views that may be rendered.
  2. $this->factory->incrementRender();
  3. $this->factory->callComposer($this);
  4. $contents = $this->getContents();
  5. // Once we've finished rendering the view, we'll decrement the render count
  6. // so that each section gets flushed out next time a view is created and
  7. // no old sections are staying around in the memory of an environment.
  8. $this->factory->decrementRender();
  1. * @throws \Throwable
  2. */
  3. public function render(?callable $callback = null)
  4. {
  5. try {
  6. $contents = $this->renderContents();
  7. $response = isset($callback) ? $callback($this, $contents) : null;
  8. // Once we have the contents of the view, we will flush the sections if we are
  9. // done rendering all views so that there is nothing left hanging over when
  1. $revertA = Utils::shareWithViews('__livewire', $component);
  2. $revertB = Utils::shareWithViews('_instance', $component); // @deprecated
  3. $viewContext = new ViewContext;
  4. $html = $view->render(function ($view) use ($viewContext) {
  5. // Extract leftover slots, sections, and pushes before they get flushed...
  6. $viewContext->extractFromEnvironment($view->getFactory());
  7. });
  8. $revertA(); $revertB();
  1. protected function trackInRenderStack($component, $callback)
  2. {
  3. array_push(static::$renderStack, $component);
  4. return tap($callback(), function () {
  5. array_pop(static::$renderStack);
  6. });
  7. }
  8. protected function updateProperties($component, $updates, $data, $context)
  1. ]);
  2. }
  3. [ $view, $properties ] = $this->getView($component);
  4. return $this->trackInRenderStack($component, function () use ($component, $view, $properties) {
  5. $finish = trigger('render', $component, $view, $properties);
  6. $revertA = Utils::shareWithViews('__livewire', $component);
  7. $revertB = Utils::shareWithViews('_instance', $component); // @deprecated
  1. if (config('app.debug')) $start = microtime(true);
  2. $finish = trigger('mount', $component, $params, $key, $parent);
  3. if (config('app.debug')) trigger('profile', 'mount', $component->getId(), [$start, microtime(true)]);
  4. if (config('app.debug')) $start = microtime(true);
  5. $html = $this->render($component, '<div></div>');
  6. if (config('app.debug')) trigger('profile', 'render', $component->getId(), [$start, microtime(true)]);
  7. if (config('app.debug')) $start = microtime(true);
  8. trigger('dehydrate', $component, $context);
  1. return app(ComponentRegistry::class)->resolveMissingComponent($resolver);
  2. }
  3. function mount($name, $params = [], $key = null)
  4. {
  5. return app(HandleComponents::class)->mount($name, $params, $key);
  6. }
  7. function snapshot($component, $context = null)
  8. {
  9. return app(HandleComponents::class)->snapshot($component, $context);
  1. $html = null;
  2. $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) {
  3. $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this);
  4. $html = app('livewire')->mount($this::class, $params);
  5. });
  6. $layoutConfig = $layoutConfig ?: new PageComponentConfig;
  7. $layoutConfig->normalizeViewNameAndParamsForBladeComponents();
  1. });
  2. on('render', $handler);
  3. on('render.placeholder', $handler);
  4. $callback();
  5. off('render', $handler);
  6. off('render.placeholder', $handler);
  7. return $layoutConfig;
in /home/dwg-germany.de/dwg/vendor/livewire/livewire/src/Features/SupportPageComponents/HandlesPageComponents.php :: interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration (line 14)
  1. // Here's we're hooking into the "__invoke" method being called on a component.
  2. // This way, users can pass Livewire components into Routes as if they were
  3. // simple invokable controllers. Ex: Route::get('...', SomeLivewireComponent::class);
  4. $html = null;
  5. $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) {
  6. $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this);
  7. $html = app('livewire')->mount($this::class, $params);
  8. });
  1. if (method_exists($controller, 'callAction')) {
  2. return $controller->callAction($method, $parameters);
  3. }
  4. return $controller->{$method}(...array_values($parameters));
  5. }
  6. /**
  7. * Resolve the parameters for the controller.
  8. *
  1. *
  2. * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  3. */
  4. protected function runController()
  5. {
  6. return $this->controllerDispatcher()->dispatch(
  7. $this, $this->getController(), $this->getControllerMethod()
  8. );
  9. }
  10. /**
  1. {
  2. $this->container = $this->container ?: new Container;
  3. try {
  4. if ($this->isControllerAction()) {
  5. return $this->runController();
  6. }
  7. return $this->runCallable();
  8. } catch (HttpResponseException $e) {
  9. return $e->getResponse();
  1. return (new Pipeline($this->container))
  2. ->send($request)
  3. ->through($middleware)
  4. ->then(fn ($request) => $this->prepareResponse(
  5. $request, $route->run()
  6. ));
  7. }
  8. /**
  9. * Gather the middleware for the given route with resolved class names.
  1. */
  2. protected function prepareDestination(Closure $destination)
  3. {
  4. return function ($passable) use ($destination) {
  5. try {
  6. return $destination($passable);
  7. } catch (Throwable $e) {
  8. return $this->handleException($passable, $e);
  9. }
  10. };
  11. }
Pipeline->Illuminate\Pipeline\{closure}() in /home/dwg-germany.de/dwg/app/Http/Middleware/Shared.php (line 25)
  1. $footer_header=PageContent::whereIN('page', ['footer','header'])
  2. ->where('locale', app()->getLocale())
  3. ->pluck('value', 'key')
  4. ->toArray();
  5. View::share('footer_header', $footer_header);
  6. return $next($request);
  7. }
  8. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
Pipeline->Illuminate\Pipeline\{closure}() in /home/dwg-germany.de/dwg/app/Http/Middleware/SetLocale.php (line 24)
  1. App::setLocale($locale);
  2. // dd(0);
  3. // return redirect($locale . '/' . $request->path());
  4. }
  5. return $next($request);
  6. }
  7. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. }
  2. throw $exception;
  3. }
  4. return $next($request);
  5. }
  6. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $this->isReading($request) ||
  2. $this->runningUnitTests() ||
  3. $this->inExceptArray($request) ||
  4. $this->tokensMatch($request)
  5. ) {
  6. return tap($next($request), function ($response) use ($request) {
  7. if ($this->shouldAddXsrfTokenCookie()) {
  8. $this->addCookieToResponse($request, $response);
  9. }
  10. });
  11. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. // Putting the errors in the view for every view allows the developer to just
  2. // assume that some errors are always available, which is convenient since
  3. // they don't have to continually run checks for the presence of errors.
  4. return $next($request);
  5. }
  6. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $this->startSession($request, $session)
  2. );
  3. $this->collectGarbage($session);
  4. $response = $next($request);
  5. $this->storeCurrentUrl($request, $session);
  6. $this->addCookieToResponse($response, $session);
  1. if ($this->manager->shouldBlock() ||
  2. ($request->route() instanceof Route && $request->route()->locksFor())) {
  3. return $this->handleRequestWhileBlocking($request, $session, $next);
  4. }
  5. return $this->handleStatefulRequest($request, $session, $next);
  6. }
  7. /**
  8. * Handle the given request within session state.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @param \Closure $next
  2. * @return mixed
  3. */
  4. public function handle($request, Closure $next)
  5. {
  6. $response = $next($request);
  7. foreach ($this->cookies->getQueuedCookies() as $cookie) {
  8. $response->headers->setCookie($cookie);
  9. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @param \Closure $next
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function handle($request, Closure $next)
  5. {
  6. return $this->encrypt($next($this->decrypt($request)));
  7. }
  8. /**
  9. * Decrypt the cookies on the request.
  10. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $pipeline = array_reduce(
  2. array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  3. );
  4. try {
  5. return $pipeline($this->passable);
  6. } finally {
  7. if ($this->finally) {
  8. ($this->finally)($this->passable);
  9. }
  10. }
  1. $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
  2. return (new Pipeline($this->container))
  3. ->send($request)
  4. ->through($middleware)
  5. ->then(fn ($request) => $this->prepareResponse(
  6. $request, $route->run()
  7. ));
  8. }
  9. /**
  1. $request->setRouteResolver(fn () => $route);
  2. $this->events->dispatch(new RouteMatched($route, $request));
  3. return $this->prepareResponse($request,
  4. $this->runRouteWithinStack($route, $request)
  5. );
  6. }
  7. /**
  8. * Run the given route within a Stack "onion" instance.
  1. * @param \Illuminate\Http\Request $request
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function dispatchToRoute(Request $request)
  5. {
  6. return $this->runRoute($request, $this->findRoute($request));
  7. }
  8. /**
  9. * Find the route matching a given request.
  10. *
  1. */
  2. public function dispatch(Request $request)
  3. {
  4. $this->currentRequest = $request;
  5. return $this->dispatchToRoute($request);
  6. }
  7. /**
  8. * Dispatch the request to a route and return the response.
  9. *
  1. protected function dispatchToRouter()
  2. {
  3. return function ($request) {
  4. $this->app->instance('request', $request);
  5. return $this->router->dispatch($request);
  6. };
  7. }
  8. /**
  9. * Call the terminate method on any terminable middleware.
  1. */
  2. protected function prepareDestination(Closure $destination)
  3. {
  4. return function ($passable) use ($destination) {
  5. try {
  6. return $destination($passable);
  7. } catch (Throwable $e) {
  8. return $this->handleException($passable, $e);
  9. }
  10. };
  11. }
  1. * @param \Closure $next
  2. * @return mixed
  3. */
  4. public function handle($request, Closure $next)
  5. {
  6. $response = $next($request);
  7. if ($response instanceof Response && SupportDisablingBackButtonCache::$disableBackButtonCache){
  8. $response->headers->add([
  9. 'Pragma' => 'no-cache',
  10. 'Expires' => 'Fri, 01 Jan 1990 00:00:00 GMT',
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. */
  2. public function handle($request, Closure $next)
  3. {
  4. $this->clean($request);
  5. return $next($request);
  6. }
  7. /**
  8. * Clean the request's data.
  9. *
  1. if ($callback($request)) {
  2. return $next($request);
  3. }
  4. }
  5. return parent::handle($request, $next);
  6. }
  7. /**
  8. * Transform the given value.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. */
  2. public function handle($request, Closure $next)
  3. {
  4. $this->clean($request);
  5. return $next($request);
  6. }
  7. /**
  8. * Clean the request's data.
  9. *
  1. if ($callback($request)) {
  2. return $next($request);
  3. }
  4. }
  5. return parent::handle($request, $next);
  6. }
  7. /**
  8. * Transform the given value.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {
  2. throw new PostTooLargeException('The POST data is too large.');
  3. }
  4. return $next($request);
  5. }
  6. /**
  7. * Determine the server 'post_max_size' as bytes.
  8. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. null,
  2. $this->getHeaders($data)
  3. );
  4. }
  5. return $next($request);
  6. }
  7. /**
  8. * Determine if the incoming request has a maintenance mode bypass cookie.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @return \Illuminate\Http\Response
  2. */
  3. public function handle($request, Closure $next)
  4. {
  5. if (! $this->hasMatchingPath($request)) {
  6. return $next($request);
  7. }
  8. $this->cors->setOptions($this->container['config']->get('cors', []));
  9. if ($this->cors->isPreflightRequest($request)) {
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. {
  2. $request::setTrustedProxies([], $this->getTrustedHeaderNames());
  3. $this->setTrustedProxyIpAddresses($request);
  4. return $next($request);
  5. }
  6. /**
  7. * Sets the trusted proxies on the request.
  8. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @param \Closure $next
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function handle(Request $request, Closure $next)
  5. {
  6. return $next($request);
  7. }
  8. /**
  9. * Invoke the deferred callbacks.
  10. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $pipeline = array_reduce(
  2. array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  3. );
  4. try {
  5. return $pipeline($this->passable);
  6. } finally {
  7. if ($this->finally) {
  8. ($this->finally)($this->passable);
  9. }
  10. }
  1. $this->bootstrap();
  2. return (new Pipeline($this->app))
  3. ->send($request)
  4. ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
  5. ->then($this->dispatchToRouter());
  6. }
  7. /**
  8. * Bootstrap the application for HTTP requests.
  9. *
  1. $this->requestStartedAt = Carbon::now();
  2. try {
  3. $request->enableHttpMethodParameterOverride();
  4. $response = $this->sendRequestThroughRouter($request);
  5. } catch (Throwable $e) {
  6. $this->reportException($e);
  7. $response = $this->renderException($request, $e);
  8. }
  1. */
  2. public function handleRequest(Request $request)
  3. {
  4. $kernel = $this->make(HttpKernelContract::class);
  5. $response = $kernel->handle($request)->send();
  6. $kernel->terminate($request, $response);
  7. }
  8. /**
Application->handleRequest() in /home/dwg-germany.de/dwg/public/index.php (line 17)
  1. // Register the Composer autoloader...
  2. require __DIR__.'/../vendor/autoload.php';
  3. // Bootstrap Laravel and handle the request...
  4. (require_once __DIR__.'/../bootstrap/app.php')
  5. ->handleRequest(Request::capture());

Illuminate\Database\ QueryException

SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server. (Connection: sqlsrv, SQL: select * from [service_translations] where [service_translations].[service_id] = 11 and [service_translations].[service_id] is not null)

  1. throw new UniqueConstraintViolationException(
  2. $this->getName(), $query, $this->prepareBindings($bindings), $e
  3. );
  4. }
  5. throw new QueryException(
  6. $this->getName(), $query, $this->prepareBindings($bindings), $e
  7. );
  8. }
  9. }
  1. protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback)
  2. {
  3. if ($this->causedByLostConnection($e->getPrevious())) {
  4. $this->reconnect();
  5. return $this->runQueryCallback($query, $bindings, $callback);
  6. }
  7. throw $e;
  8. }
  1. {
  2. if ($this->transactions >= 1) {
  3. throw $e;
  4. }
  5. return $this->tryAgainIfCausedByLostConnection(
  6. $e, $query, $bindings, $callback
  7. );
  8. }
  9. /**
  1. // caused by a connection that has been lost. If that is the cause, we'll try
  2. // to re-establish connection and re-run the query with a fresh connection.
  3. try {
  4. $result = $this->runQueryCallback($query, $bindings, $callback);
  5. } catch (QueryException $e) {
  6. $result = $this->handleQueryException(
  7. $e, $query, $bindings, $callback
  8. );
  9. }
  10. // Once we have run the query we will calculate the time that it took to run and
  1. * @param bool $useReadPdo
  2. * @return array
  3. */
  4. public function select($query, $bindings = [], $useReadPdo = true)
  5. {
  6. return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {
  7. if ($this->pretending()) {
  8. return [];
  9. }
  10. // For select statements, we'll simply execute the query and return an array
  1. *
  2. * @return array
  3. */
  4. protected function runSelect()
  5. {
  6. return $this->connection->select(
  7. $this->toSql(), $this->getBindings(), ! $this->useWritePdo
  8. );
  9. }
  10. /**
  1. * @return \Illuminate\Support\Collection<int, \stdClass>
  2. */
  3. public function get($columns = ['*'])
  4. {
  5. $items = new Collection($this->onceWithColumns(Arr::wrap($columns), function () {
  6. return $this->processor->processSelect($this, $this->runSelect());
  7. }));
  8. return $this->applyAfterQueryCallbacks(
  9. isset($this->groupLimit) ? $this->withoutGroupLimitKeys($items) : $items
  10. );
  1. if (is_null($original)) {
  2. $this->columns = $columns;
  3. }
  4. $result = $callback();
  5. $this->columns = $original;
  6. return $result;
  7. }
  1. * @param array|string $columns
  2. * @return \Illuminate\Support\Collection<int, \stdClass>
  3. */
  4. public function get($columns = ['*'])
  5. {
  6. $items = new Collection($this->onceWithColumns(Arr::wrap($columns), function () {
  7. return $this->processor->processSelect($this, $this->runSelect());
  8. }));
  9. return $this->applyAfterQueryCallbacks(
  10. isset($this->groupLimit) ? $this->withoutGroupLimitKeys($items) : $items
  1. * @return array<int, TModel>
  2. */
  3. public function getModels($columns = ['*'])
  4. {
  5. return $this->model->hydrate(
  6. $this->query->get($columns)->all()
  7. )->all();
  8. }
  9. /**
  10. * Eager load the relationships for the models.
  1. $builder = $this->applyScopes();
  2. // If we actually found models we will also eager load any relationships that
  3. // have been specified as needing to be eager loaded, which will solve the
  4. // n+1 query issue for the developers to avoid running a lot of queries.
  5. if (count($models = $builder->getModels($columns)) > 0) {
  6. $models = $builder->eagerLoadRelations($models);
  7. }
  8. return $this->applyAfterQueryCallbacks(
  9. $builder->getModel()->newCollection($models)
  1. /** @inheritDoc */
  2. public function getResults()
  3. {
  4. return ! is_null($this->getParentKey())
  5. ? $this->query->get()
  6. : $this->related->newCollection();
  7. }
  8. /** @inheritDoc */
  9. public function initRelation(array $models, $relation)
  1. throw new LogicException(sprintf(
  2. '%s::%s must return a relationship instance.', static::class, $method
  3. ));
  4. }
  5. return tap($relation->getResults(), function ($results) use ($method) {
  6. $this->setRelation($method, $results);
  7. });
  8. }
  9. /**
  1. }
  2. // If the "attribute" exists as a method on the model, we will just assume
  3. // it is a relationship and will load and return results from the query
  4. // and hydrate the relationship's value on the "relationships" array.
  5. return $this->getRelationshipFromMethod($key);
  6. }
  7. /**
  8. * Determine if the given key is a relationship method on the model.
  9. *
  1. if (method_exists(self::class, $key)) {
  2. return $this->throwMissingAttributeExceptionIfApplicable($key);
  3. }
  4. return $this->isRelation($key) || $this->relationLoaded($key)
  5. ? $this->getRelationValue($key)
  6. : $this->throwMissingAttributeExceptionIfApplicable($key);
  7. }
  8. /**
  9. * Either throw a missing attribute exception or return null depending on Eloquent's configuration.
  1. }
  2. return $this->getAttributeOrFallback($locale, $attribute);
  3. }
  4. return parent::getAttribute($key);
  5. }
  6. public function getDefaultLocale(): ?string
  7. {
  8. return $this->defaultLocale;
  1. * @param string $key
  2. * @return mixed
  3. */
  4. public function __get($key)
  5. {
  6. return $this->getAttribute($key);
  7. }
  8. /**
  9. * Dynamically set attributes on the model.
  10. *
  1. && $this->translation->getAttribute($this->getLocaleKey()) == $key
  2. ) {
  3. return $this->translation;
  4. }
  5. return $this->translations->firstWhere($this->getLocaleKey(), $key);
  6. }
  7. protected function toArrayAlwaysLoadsTranslations(): bool
  8. {
  9. return config('translatable.to_array_always_loads_translations', true);
  1. $configFallbackLocale = $this->getFallbackLocale();
  2. $locale = $locale ?: $this->locale();
  3. $withFallback = $withFallback === null ? $this->useFallback() : $withFallback;
  4. $fallbackLocale = $this->getFallbackLocale($locale);
  5. if ($translation = $this->getTranslationByLocaleKey($locale)) {
  6. return $translation;
  7. }
  8. if ($withFallback && $fallbackLocale) {
  9. if ($translation = $this->getTranslationByLocaleKey($fallbackLocale)) {
  1. public function getAttribute($key)
  2. {
  3. [$attribute, $locale] = $this->getAttributeAndLocale($key);
  4. if ($this->isTranslationAttribute($attribute)) {
  5. if ($this->getTranslation($locale) === null) {
  6. return $this->getAttributeValue($attribute);
  7. }
  8. // If the given $attribute has a mutator, we push it to $attributes and then call getAttributeValue
  9. // on it. This way, we can use Eloquent's checking for Mutation, type casting, and
  1. * @param string $key
  2. * @return mixed
  3. */
  4. public function __get($key)
  5. {
  6. return $this->getAttribute($key);
  7. }
  8. /**
  9. * Dynamically set attributes on the model.
  10. *
  1. </div>
  2. <div class="row g-5 mt--30">
  3. <?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(); ?>
  4. <div class="col-lg-3 col-md-4 col-sm-6 col-12">
  5. <!-- single course category -->
  6. <a href="/<?php echo e(app()->getLocale()); ?>/services/<?php echo e($service->id); ?>/<?php echo e($service->name); ?>"
  7. class="single-category-2">
  8. <img src="<?php echo e(Storage::url($service->icon)); ?>" alt="<?php echo e($service->name); ?>"
  9. style="
  10. width: 100%;
  1. try {
  2. $component = ExtendBlade::currentRendering();
  3. \Closure::bind(function () use ($__path, $__data) {
  4. extract($__data, EXTR_SKIP);
  5. include $__path;
  6. }, $component, $component)();
  7. } catch (\Exception|\Throwable $e) {
  8. $this->handleViewException($e, $obLevel);
  9. }
  1. $component = ExtendBlade::currentRendering();
  2. \Closure::bind(function () use ($__path, $__data) {
  3. extract($__data, EXTR_SKIP);
  4. include $__path;
  5. }, $component, $component)();
  6. } catch (\Exception|\Throwable $e) {
  7. $this->handleViewException($e, $obLevel);
  8. }
  9. return ltrim(ob_get_clean());
  1. // Once we have the path to the compiled file, we will evaluate the paths with
  2. // typical PHP just like any other templates. We also keep a stack of views
  3. // which have been rendered for right exception messages to be generated.
  4. try {
  5. $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data);
  6. } catch (ViewException $e) {
  7. if (! Str::of($e->getMessage())->contains(['No such file or directory', 'File does not exist at path'])) {
  8. throw $e;
  9. }
  1. $currentComponent = ExtendBlade::currentRendering();
  2. trigger('view:compile', $currentComponent, $path);
  3. return parent::get($path, $data);
  4. }
  5. protected function evaluatePath($__path, $__data)
  6. {
  7. if (! ExtendBlade::isRenderingLivewireComponent()) {
  1. *
  2. * @return string
  3. */
  4. protected function getContents()
  5. {
  6. return $this->engine->get($this->path, $this->gatherData());
  7. }
  8. /**
  9. * Get the data bound to the view instance.
  10. *
  1. // clear out the sections for any separate views that may be rendered.
  2. $this->factory->incrementRender();
  3. $this->factory->callComposer($this);
  4. $contents = $this->getContents();
  5. // Once we've finished rendering the view, we'll decrement the render count
  6. // so that each section gets flushed out next time a view is created and
  7. // no old sections are staying around in the memory of an environment.
  8. $this->factory->decrementRender();
  1. * @throws \Throwable
  2. */
  3. public function render(?callable $callback = null)
  4. {
  5. try {
  6. $contents = $this->renderContents();
  7. $response = isset($callback) ? $callback($this, $contents) : null;
  8. // Once we have the contents of the view, we will flush the sections if we are
  9. // done rendering all views so that there is nothing left hanging over when
  1. $revertA = Utils::shareWithViews('__livewire', $component);
  2. $revertB = Utils::shareWithViews('_instance', $component); // @deprecated
  3. $viewContext = new ViewContext;
  4. $html = $view->render(function ($view) use ($viewContext) {
  5. // Extract leftover slots, sections, and pushes before they get flushed...
  6. $viewContext->extractFromEnvironment($view->getFactory());
  7. });
  8. $revertA(); $revertB();
  1. protected function trackInRenderStack($component, $callback)
  2. {
  3. array_push(static::$renderStack, $component);
  4. return tap($callback(), function () {
  5. array_pop(static::$renderStack);
  6. });
  7. }
  8. protected function updateProperties($component, $updates, $data, $context)
  1. ]);
  2. }
  3. [ $view, $properties ] = $this->getView($component);
  4. return $this->trackInRenderStack($component, function () use ($component, $view, $properties) {
  5. $finish = trigger('render', $component, $view, $properties);
  6. $revertA = Utils::shareWithViews('__livewire', $component);
  7. $revertB = Utils::shareWithViews('_instance', $component); // @deprecated
  1. if (config('app.debug')) $start = microtime(true);
  2. $finish = trigger('mount', $component, $params, $key, $parent);
  3. if (config('app.debug')) trigger('profile', 'mount', $component->getId(), [$start, microtime(true)]);
  4. if (config('app.debug')) $start = microtime(true);
  5. $html = $this->render($component, '<div></div>');
  6. if (config('app.debug')) trigger('profile', 'render', $component->getId(), [$start, microtime(true)]);
  7. if (config('app.debug')) $start = microtime(true);
  8. trigger('dehydrate', $component, $context);
  1. return app(ComponentRegistry::class)->resolveMissingComponent($resolver);
  2. }
  3. function mount($name, $params = [], $key = null)
  4. {
  5. return app(HandleComponents::class)->mount($name, $params, $key);
  6. }
  7. function snapshot($component, $context = null)
  8. {
  9. return app(HandleComponents::class)->snapshot($component, $context);
  1. $html = null;
  2. $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) {
  3. $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this);
  4. $html = app('livewire')->mount($this::class, $params);
  5. });
  6. $layoutConfig = $layoutConfig ?: new PageComponentConfig;
  7. $layoutConfig->normalizeViewNameAndParamsForBladeComponents();
  1. });
  2. on('render', $handler);
  3. on('render.placeholder', $handler);
  4. $callback();
  5. off('render', $handler);
  6. off('render.placeholder', $handler);
  7. return $layoutConfig;
in /home/dwg-germany.de/dwg/vendor/livewire/livewire/src/Features/SupportPageComponents/HandlesPageComponents.php :: interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration (line 14)
  1. // Here's we're hooking into the "__invoke" method being called on a component.
  2. // This way, users can pass Livewire components into Routes as if they were
  3. // simple invokable controllers. Ex: Route::get('...', SomeLivewireComponent::class);
  4. $html = null;
  5. $layoutConfig = SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration(function () use (&$html) {
  6. $params = SupportPageComponents::gatherMountMethodParamsFromRouteParameters($this);
  7. $html = app('livewire')->mount($this::class, $params);
  8. });
  1. if (method_exists($controller, 'callAction')) {
  2. return $controller->callAction($method, $parameters);
  3. }
  4. return $controller->{$method}(...array_values($parameters));
  5. }
  6. /**
  7. * Resolve the parameters for the controller.
  8. *
  1. *
  2. * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  3. */
  4. protected function runController()
  5. {
  6. return $this->controllerDispatcher()->dispatch(
  7. $this, $this->getController(), $this->getControllerMethod()
  8. );
  9. }
  10. /**
  1. {
  2. $this->container = $this->container ?: new Container;
  3. try {
  4. if ($this->isControllerAction()) {
  5. return $this->runController();
  6. }
  7. return $this->runCallable();
  8. } catch (HttpResponseException $e) {
  9. return $e->getResponse();
  1. return (new Pipeline($this->container))
  2. ->send($request)
  3. ->through($middleware)
  4. ->then(fn ($request) => $this->prepareResponse(
  5. $request, $route->run()
  6. ));
  7. }
  8. /**
  9. * Gather the middleware for the given route with resolved class names.
  1. */
  2. protected function prepareDestination(Closure $destination)
  3. {
  4. return function ($passable) use ($destination) {
  5. try {
  6. return $destination($passable);
  7. } catch (Throwable $e) {
  8. return $this->handleException($passable, $e);
  9. }
  10. };
  11. }
Pipeline->Illuminate\Pipeline\{closure}() in /home/dwg-germany.de/dwg/app/Http/Middleware/Shared.php (line 25)
  1. $footer_header=PageContent::whereIN('page', ['footer','header'])
  2. ->where('locale', app()->getLocale())
  3. ->pluck('value', 'key')
  4. ->toArray();
  5. View::share('footer_header', $footer_header);
  6. return $next($request);
  7. }
  8. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
Pipeline->Illuminate\Pipeline\{closure}() in /home/dwg-germany.de/dwg/app/Http/Middleware/SetLocale.php (line 24)
  1. App::setLocale($locale);
  2. // dd(0);
  3. // return redirect($locale . '/' . $request->path());
  4. }
  5. return $next($request);
  6. }
  7. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. }
  2. throw $exception;
  3. }
  4. return $next($request);
  5. }
  6. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $this->isReading($request) ||
  2. $this->runningUnitTests() ||
  3. $this->inExceptArray($request) ||
  4. $this->tokensMatch($request)
  5. ) {
  6. return tap($next($request), function ($response) use ($request) {
  7. if ($this->shouldAddXsrfTokenCookie()) {
  8. $this->addCookieToResponse($request, $response);
  9. }
  10. });
  11. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. // Putting the errors in the view for every view allows the developer to just
  2. // assume that some errors are always available, which is convenient since
  3. // they don't have to continually run checks for the presence of errors.
  4. return $next($request);
  5. }
  6. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $this->startSession($request, $session)
  2. );
  3. $this->collectGarbage($session);
  4. $response = $next($request);
  5. $this->storeCurrentUrl($request, $session);
  6. $this->addCookieToResponse($response, $session);
  1. if ($this->manager->shouldBlock() ||
  2. ($request->route() instanceof Route && $request->route()->locksFor())) {
  3. return $this->handleRequestWhileBlocking($request, $session, $next);
  4. }
  5. return $this->handleStatefulRequest($request, $session, $next);
  6. }
  7. /**
  8. * Handle the given request within session state.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @param \Closure $next
  2. * @return mixed
  3. */
  4. public function handle($request, Closure $next)
  5. {
  6. $response = $next($request);
  7. foreach ($this->cookies->getQueuedCookies() as $cookie) {
  8. $response->headers->setCookie($cookie);
  9. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @param \Closure $next
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function handle($request, Closure $next)
  5. {
  6. return $this->encrypt($next($this->decrypt($request)));
  7. }
  8. /**
  9. * Decrypt the cookies on the request.
  10. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $pipeline = array_reduce(
  2. array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  3. );
  4. try {
  5. return $pipeline($this->passable);
  6. } finally {
  7. if ($this->finally) {
  8. ($this->finally)($this->passable);
  9. }
  10. }
  1. $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
  2. return (new Pipeline($this->container))
  3. ->send($request)
  4. ->through($middleware)
  5. ->then(fn ($request) => $this->prepareResponse(
  6. $request, $route->run()
  7. ));
  8. }
  9. /**
  1. $request->setRouteResolver(fn () => $route);
  2. $this->events->dispatch(new RouteMatched($route, $request));
  3. return $this->prepareResponse($request,
  4. $this->runRouteWithinStack($route, $request)
  5. );
  6. }
  7. /**
  8. * Run the given route within a Stack "onion" instance.
  1. * @param \Illuminate\Http\Request $request
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function dispatchToRoute(Request $request)
  5. {
  6. return $this->runRoute($request, $this->findRoute($request));
  7. }
  8. /**
  9. * Find the route matching a given request.
  10. *
  1. */
  2. public function dispatch(Request $request)
  3. {
  4. $this->currentRequest = $request;
  5. return $this->dispatchToRoute($request);
  6. }
  7. /**
  8. * Dispatch the request to a route and return the response.
  9. *
  1. protected function dispatchToRouter()
  2. {
  3. return function ($request) {
  4. $this->app->instance('request', $request);
  5. return $this->router->dispatch($request);
  6. };
  7. }
  8. /**
  9. * Call the terminate method on any terminable middleware.
  1. */
  2. protected function prepareDestination(Closure $destination)
  3. {
  4. return function ($passable) use ($destination) {
  5. try {
  6. return $destination($passable);
  7. } catch (Throwable $e) {
  8. return $this->handleException($passable, $e);
  9. }
  10. };
  11. }
  1. * @param \Closure $next
  2. * @return mixed
  3. */
  4. public function handle($request, Closure $next)
  5. {
  6. $response = $next($request);
  7. if ($response instanceof Response && SupportDisablingBackButtonCache::$disableBackButtonCache){
  8. $response->headers->add([
  9. 'Pragma' => 'no-cache',
  10. 'Expires' => 'Fri, 01 Jan 1990 00:00:00 GMT',
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. */
  2. public function handle($request, Closure $next)
  3. {
  4. $this->clean($request);
  5. return $next($request);
  6. }
  7. /**
  8. * Clean the request's data.
  9. *
  1. if ($callback($request)) {
  2. return $next($request);
  3. }
  4. }
  5. return parent::handle($request, $next);
  6. }
  7. /**
  8. * Transform the given value.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. */
  2. public function handle($request, Closure $next)
  3. {
  4. $this->clean($request);
  5. return $next($request);
  6. }
  7. /**
  8. * Clean the request's data.
  9. *
  1. if ($callback($request)) {
  2. return $next($request);
  3. }
  4. }
  5. return parent::handle($request, $next);
  6. }
  7. /**
  8. * Transform the given value.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {
  2. throw new PostTooLargeException('The POST data is too large.');
  3. }
  4. return $next($request);
  5. }
  6. /**
  7. * Determine the server 'post_max_size' as bytes.
  8. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. null,
  2. $this->getHeaders($data)
  3. );
  4. }
  5. return $next($request);
  6. }
  7. /**
  8. * Determine if the incoming request has a maintenance mode bypass cookie.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @return \Illuminate\Http\Response
  2. */
  3. public function handle($request, Closure $next)
  4. {
  5. if (! $this->hasMatchingPath($request)) {
  6. return $next($request);
  7. }
  8. $this->cors->setOptions($this->container['config']->get('cors', []));
  9. if ($this->cors->isPreflightRequest($request)) {
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. {
  2. $request::setTrustedProxies([], $this->getTrustedHeaderNames());
  3. $this->setTrustedProxyIpAddresses($request);
  4. return $next($request);
  5. }
  6. /**
  7. * Sets the trusted proxies on the request.
  8. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @param \Closure $next
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function handle(Request $request, Closure $next)
  5. {
  6. return $next($request);
  7. }
  8. /**
  9. * Invoke the deferred callbacks.
  10. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. $pipeline = array_reduce(
  2. array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  3. );
  4. try {
  5. return $pipeline($this->passable);
  6. } finally {
  7. if ($this->finally) {
  8. ($this->finally)($this->passable);
  9. }
  10. }
  1. $this->bootstrap();
  2. return (new Pipeline($this->app))
  3. ->send($request)
  4. ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
  5. ->then($this->dispatchToRouter());
  6. }
  7. /**
  8. * Bootstrap the application for HTTP requests.
  9. *
  1. $this->requestStartedAt = Carbon::now();
  2. try {
  3. $request->enableHttpMethodParameterOverride();
  4. $response = $this->sendRequestThroughRouter($request);
  5. } catch (Throwable $e) {
  6. $this->reportException($e);
  7. $response = $this->renderException($request, $e);
  8. }
  1. */
  2. public function handleRequest(Request $request)
  3. {
  4. $kernel = $this->make(HttpKernelContract::class);
  5. $response = $kernel->handle($request)->send();
  6. $kernel->terminate($request, $response);
  7. }
  8. /**
Application->handleRequest() in /home/dwg-germany.de/dwg/public/index.php (line 17)
  1. // Register the Composer autoloader...
  2. require __DIR__.'/../vendor/autoload.php';
  3. // Bootstrap Laravel and handle the request...
  4. (require_once __DIR__.'/../bootstrap/app.php')
  5. ->handleRequest(Request::capture());

PDOException

SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server.

  1. * @return \PDO
  2. */
  3. protected function createPdoConnection($dsn, $username, #[\SensitiveParameter] $password, $options)
  4. {
  5. return version_compare(phpversion(), '8.4.0', '<')
  6. ? new PDO($dsn, $username, $password, $options)
  7. : PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */
  8. }
  9. /**
  10. * Handle an exception that occurred during connect execution.
  1. * @return \PDO
  2. */
  3. protected function createPdoConnection($dsn, $username, #[\SensitiveParameter] $password, $options)
  4. {
  5. return version_compare(phpversion(), '8.4.0', '<')
  6. ? new PDO($dsn, $username, $password, $options)
  7. : PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */
  8. }
  9. /**
  10. * Handle an exception that occurred during connect execution.
  1. [$username, $password] = [
  2. $config['username'] ?? null, $config['password'] ?? null,
  3. ];
  4. try {
  5. return $this->createPdoConnection(
  6. $dsn, $username, $password, $options
  7. );
  8. } catch (Exception $e) {
  9. return $this->tryAgainIfCausedByLostConnection(
  10. $e, $dsn, $username, $password, $options
  1. */
  2. public function connect(array $config)
  3. {
  4. $options = $this->getOptions($config);
  5. $connection = $this->createConnection($this->getDsn($config), $config, $options);
  6. $this->configureIsolationLevel($connection, $config);
  7. return $connection;
  8. }
  1. return function () use ($config) {
  2. foreach (Arr::shuffle($this->parseHosts($config)) as $host) {
  3. $config['host'] = $host;
  4. try {
  5. return $this->createConnector($config)->connect($config);
  6. } catch (PDOException $e) {
  7. continue;
  8. }
  9. }
ConnectionFactory->Illuminate\Database\Connectors\{closure}()
  1. * @return \PDO
  2. */
  3. public function getPdo()
  4. {
  5. if ($this->pdo instanceof Closure) {
  6. return $this->pdo = call_user_func($this->pdo);
  7. }
  8. return $this->pdo;
  9. }
  1. if ($this->readPdo instanceof Closure) {
  2. return $this->readPdo = call_user_func($this->readPdo);
  3. }
  4. return $this->readPdo ?: $this->getPdo();
  5. }
  6. /**
  7. * Get the current read PDO connection parameter without executing any reconnect logic.
  8. *
  1. * @param bool $useReadPdo
  2. * @return \PDO
  3. */
  4. protected function getPdoForSelect($useReadPdo = true)
  5. {
  6. return $useReadPdo ? $this->getReadPdo() : $this->getPdo();
  7. }
  8. /**
  9. * Run an insert statement against the database.
  10. *
  1. // For select statements, we'll simply execute the query and return an array
  2. // of the database result set. Each element in the array will be a single
  3. // row from the database table, and will either be an array or objects.
  4. $statement = $this->prepared(
  5. $this->getPdoForSelect($useReadPdo)->prepare($query)
  6. );
  7. $this->bindValues($statement, $this->prepareBindings($bindings));
  8. $statement->execute();
  1. {
  2. // To execute the statement, we'll simply call the callback, which will actually
  3. // run the SQL against the PDO connection. Then we can calculate the time it
  4. // took to execute and log the query SQL, bindings and time in our memory.
  5. try {
  6. return $callback($query, $bindings);
  7. }
  8. // If an exception occurs when attempting to run a query, we'll format the error
  9. // message to include the bindings with SQL, which will make this exception a
  10. // lot more helpful to the developer instead of just the database's errors.
  1. protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback)
  2. {
  3. if ($this->causedByLostConnection($e->getPrevious())) {
  4. $this->reconnect();
  5. return $this->runQueryCallback($query, $bindings, $callback);
  6. }
  7. throw $e;
  8. }
  1. {
  2. if ($this->transactions >= 1) {
  3. throw $e;
  4. }
  5. return $this->tryAgainIfCausedByLostConnection(
  6. $e, $query, $bindings, $callback
  7. );
  8. }
  9. /**
  1. // caused by a connection that has been lost. If that is the cause, we'll try
  2. // to re-establish connection and re-run the query with a fresh connection.
  3. try {
  4. $result = $this->runQueryCallback($query, $bindings, $callback);
  5. } catch (QueryException $e) {
  6. $result = $this->handleQueryException(
  7. $e, $query, $bindings, $callback
  8. );
  9. }
  10. // Once we have run the query we will calculate the time that it took to run and
  1. * @param bool $useReadPdo
  2. * @return array
  3. */
  4. public function select($query, $bindings = [], $useReadPdo = true)
  5. {
  6. return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) {
  7. if ($this->pretending()) {
  8. return [];
  9. }
  10. // For select statements, we'll simply execute the query and return an array
  1. *
  2. * @return array
  3. */
  4. protected function runSelect()
  5. {
  6. return $this->connection->select(
  7. $this->toSql(), $this->getBindings(), ! $this->useWritePdo
  8. );
  9. }
  10. /**
  1. * @return \Illuminate\Support\Collection<int, \stdClass>
  2. */
  3. public function get($columns = ['*'])
  4. {
  5. $items = new Collection($this->onceWithColumns(Arr::wrap($columns), function () {
  6. return $this->processor->processSelect($this, $this->runSelect());
  7. }));
  8. return $this->applyAfterQueryCallbacks(
  9. isset($this->groupLimit) ? $this->withoutGroupLimitKeys($items) : $items
  10. );
<?php

namespace Illuminate\Database\Query;

use BackedEnum;
use Carbon\CarbonPeriod;
use Closure;
use DateTimeInterface;
use Illuminate\Contracts\Database\Query\Builder as BuilderContract;
use Illuminate\Contracts\Database\Query\ConditionExpression;
use Illuminate\Contracts\Database\Query\Expression as ExpressionContract;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Concerns\BuildsQueries;
use Illuminate\Database\Concerns\BuildsWhereDateClauses;
use Illuminate\Database\Concerns\ExplainsQueries;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Query\Grammars\Grammar;
use Illuminate\Database\Query\Processors\Processor;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\ForwardsCalls;
use Illuminate\Support\Traits\Macroable;
use InvalidArgumentException;
use LogicException;
use RuntimeException;
use UnitEnum;

use function Illuminate\Support\enum_value;

class Builder implements BuilderContract
{
    /** @use \Illuminate\Database\Concerns\BuildsQueries<object> */
    use BuildsWhereDateClauses, BuildsQueries, ExplainsQueries, ForwardsCalls, Macroable {
        __call as macroCall;
    }

    /**
     * The database connection instance.
     *
     * @var \Illuminate\Database\ConnectionInterface
     */
    public $connection;

    /**
     * The database query grammar instance.
     *
     * @var \Illuminate\Database\Query\Grammars\Grammar
     */
    public $grammar;

    /**
     * The database query post processor instance.
     *
     * @var \Illuminate\Database\Query\Processors\Processor
     */
    public $processor;

    /**
     * The current query value bindings.
     *
     * @var array
     */
    public $bindings = [
        'select' => [],
        'from' => [],
        'join' => [],
        'where' => [],
        'groupBy' => [],
        'having' => [],
        'order' => [],
        'union' => [],
        'unionOrder' => [],
    ];

    /**
     * An aggregate function and column to be run.
     *
     * @var array|null
     */
    public $aggregate;

    /**
     * The columns that should be returned.
     *
     * @var array|null
     */
    public $columns;

    /**
     * Indicates if the query returns distinct results.
     *
     * Occasionally contains the columns that should be distinct.
     *
     * @var bool|array
     */
    public $distinct = false;

    /**
     * The table which the query is targeting.
     *
     * @var \Illuminate\Database\Query\Expression|string
     */
    public $from;

    /**
     * The index hint for the query.
     *
     * @var \Illuminate\Database\Query\IndexHint|null
     */
    public $indexHint;

    /**
     * The table joins for the query.
     *
     * @var array|null
     */
    public $joins;

    /**
     * The where constraints for the query.
     *
     * @var array
     */
    public $wheres = [];

    /**
     * The groupings for the query.
     *
     * @var array|null
     */
    public $groups;

    /**
     * The having constraints for the query.
     *
     * @var array|null
     */
    public $havings;

    /**
     * The orderings for the query.
     *
     * @var array|null
     */
    public $orders;

    /**
     * The maximum number of records to return.
     *
     * @var int|null
     */
    public $limit;

    /**
     * The maximum number of records to return per group.
     *
     * @var array|null
     */
    public $groupLimit;

    /**
     * The number of records to skip.
     *
     * @var int|null
     */
    public $offset;

    /**
     * The query union statements.
     *
     * @var array|null
     */
    public $unions;

    /**
     * The maximum number of union records to return.
     *
     * @var int|null
     */
    public $unionLimit;

    /**
     * The number of union records to skip.
     *
     * @var int|null
     */
    public $unionOffset;

    /**
     * The orderings for the union query.
     *
     * @var array|null
     */
    public $unionOrders;

    /**
     * Indicates whether row locking is being used.
     *
     * @var string|bool|null
     */
    public $lock;

    /**
     * The callbacks that should be invoked before the query is executed.
     *
     * @var array
     */
    public $beforeQueryCallbacks = [];

    /**
     * The callbacks that should be invoked after retrieving data from the database.
     *
     * @var array
     */
    protected $afterQueryCallbacks = [];

    /**
     * All of the available clause operators.
     *
     * @var string[]
     */
    public $operators = [
        '=', '<', '>', '<=', '>=', '<>', '!=', '<=>',
        'like', 'like binary', 'not like', 'ilike',
        '&', '|', '^', '<<', '>>', '&~', 'is', 'is not',
        'rlike', 'not rlike', 'regexp', 'not regexp',
        '~', '~*', '!~', '!~*', 'similar to',
        'not similar to', 'not ilike', '~~*', '!~~*',
    ];

    /**
     * All of the available bitwise operators.
     *
     * @var string[]
     */
    public $bitwiseOperators = [
        '&', '|', '^', '<<', '>>', '&~',
    ];

    /**
     * Whether to use write pdo for the select.
     *
     * @var bool
     */
    public $useWritePdo = false;

    /**
     * Create a new query builder instance.
     *
     * @return void
     */
    public function __construct(
        ConnectionInterface $connection,
        ?Grammar $grammar = null,
        ?Processor $processor = null,
    ) {
        $this->connection = $connection;
        $this->grammar = $grammar ?: $connection->getQueryGrammar();
        $this->processor = $processor ?: $connection->getPostProcessor();
    }

    /**
     * Set the columns to be selected.
     *
     * @param  array|mixed  $columns
     * @return $this
     */
    public function select($columns = ['*'])
    {
        $this->columns = [];
        $this->bindings['select'] = [];

        $columns = is_array($columns) ? $columns : func_get_args();

        foreach ($columns as $as => $column) {
            if (is_string($as) && $this->isQueryable($column)) {
                $this->selectSub($column, $as);
            } else {
                $this->columns[] = $column;
            }
        }

        return $this;
    }

    /**
     * Add a subselect expression to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @param  string  $as
     * @return $this
     *
     * @throws \InvalidArgumentException
     */
    public function selectSub($query, $as)
    {
        [$query, $bindings] = $this->createSub($query);

        return $this->selectRaw(
            '('.$query.') as '.$this->grammar->wrap($as), $bindings
        );
    }

    /**
     * Add a new "raw" select expression to the query.
     *
     * @param  string  $expression
     * @return $this
     */
    public function selectRaw($expression, array $bindings = [])
    {
        $this->addSelect(new Expression($expression));

        if ($bindings) {
            $this->addBinding($bindings, 'select');
        }

        return $this;
    }

    /**
     * Makes "from" fetch from a subquery.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @param  string  $as
     * @return $this
     *
     * @throws \InvalidArgumentException
     */
    public function fromSub($query, $as)
    {
        [$query, $bindings] = $this->createSub($query);

        return $this->fromRaw('('.$query.') as '.$this->grammar->wrapTable($as), $bindings);
    }

    /**
     * Add a raw from clause to the query.
     *
     * @param  string  $expression
     * @param  mixed  $bindings
     * @return $this
     */
    public function fromRaw($expression, $bindings = [])
    {
        $this->from = new Expression($expression);

        $this->addBinding($bindings, 'from');

        return $this;
    }

    /**
     * Creates a subquery and parse it.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @return array
     */
    protected function createSub($query)
    {
        // If the given query is a Closure, we will execute it while passing in a new
        // query instance to the Closure. This will give the developer a chance to
        // format and work with the query before we cast it to a raw SQL string.
        if ($query instanceof Closure) {
            $callback = $query;

            $callback($query = $this->forSubQuery());
        }

        return $this->parseSub($query);
    }

    /**
     * Parse the subquery into SQL and bindings.
     *
     * @param  mixed  $query
     * @return array
     *
     * @throws \InvalidArgumentException
     */
    protected function parseSub($query)
    {
        if ($query instanceof self || $query instanceof EloquentBuilder || $query instanceof Relation) {
            $query = $this->prependDatabaseNameIfCrossDatabaseQuery($query);

            return [$query->toSql(), $query->getBindings()];
        } elseif (is_string($query)) {
            return [$query, []];
        } else {
            throw new InvalidArgumentException(
                'A subquery must be a query builder instance, a Closure, or a string.'
            );
        }
    }

    /**
     * Prepend the database name if the given query is on another database.
     *
     * @param  mixed  $query
     * @return mixed
     */
    protected function prependDatabaseNameIfCrossDatabaseQuery($query)
    {
        if ($query->getConnection()->getDatabaseName() !==
            $this->getConnection()->getDatabaseName()) {
            $databaseName = $query->getConnection()->getDatabaseName();

            if (! str_starts_with($query->from, $databaseName) && ! str_contains($query->from, '.')) {
                $query->from($databaseName.'.'.$query->from);
            }
        }

        return $query;
    }

    /**
     * Add a new select column to the query.
     *
     * @param  array|mixed  $column
     * @return $this
     */
    public function addSelect($column)
    {
        $columns = is_array($column) ? $column : func_get_args();

        foreach ($columns as $as => $column) {
            if (is_string($as) && $this->isQueryable($column)) {
                if (is_null($this->columns)) {
                    $this->select($this->from.'.*');
                }

                $this->selectSub($column, $as);
            } else {
                if (is_array($this->columns) && in_array($column, $this->columns, true)) {
                    continue;
                }

                $this->columns[] = $column;
            }
        }

        return $this;
    }

    /**
     * Force the query to only return distinct results.
     *
     * @return $this
     */
    public function distinct()
    {
        $columns = func_get_args();

        if (count($columns) > 0) {
            $this->distinct = is_array($columns[0]) || is_bool($columns[0]) ? $columns[0] : $columns;
        } else {
            $this->distinct = true;
        }

        return $this;
    }

    /**
     * Set the table which the query is targeting.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|\Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  string|null  $as
     * @return $this
     */
    public function from($table, $as = null)
    {
        if ($this->isQueryable($table)) {
            return $this->fromSub($table, $as);
        }

        $this->from = $as ? "{$table} as {$as}" : $table;

        return $this;
    }

    /**
     * Add an index hint to suggest a query index.
     *
     * @param  string  $index
     * @return $this
     */
    public function useIndex($index)
    {
        $this->indexHint = new IndexHint('hint', $index);

        return $this;
    }

    /**
     * Add an index hint to force a query index.
     *
     * @param  string  $index
     * @return $this
     */
    public function forceIndex($index)
    {
        $this->indexHint = new IndexHint('force', $index);

        return $this;
    }

    /**
     * Add an index hint to ignore a query index.
     *
     * @param  string  $index
     * @return $this
     */
    public function ignoreIndex($index)
    {
        $this->indexHint = new IndexHint('ignore', $index);

        return $this;
    }

    /**
     * Add a join clause to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @param  string  $type
     * @param  bool  $where
     * @return $this
     */
    public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false)
    {
        $join = $this->newJoinClause($this, $type, $table);

        // If the first "column" of the join is really a Closure instance the developer
        // is trying to build a join with a complex "on" clause containing more than
        // one condition, so we'll add the join and call a Closure with the query.
        if ($first instanceof Closure) {
            $first($join);

            $this->joins[] = $join;

            $this->addBinding($join->getBindings(), 'join');
        }

        // If the column is simply a string, we can assume the join simply has a basic
        // "on" clause with a single condition. So we will just build the join with
        // this simple join clauses attached to it. There is not a join callback.
        else {
            $method = $where ? 'where' : 'on';

            $this->joins[] = $join->$method($first, $operator, $second);

            $this->addBinding($join->getBindings(), 'join');
        }

        return $this;
    }

    /**
     * Add a "join where" clause to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $second
     * @param  string  $type
     * @return $this
     */
    public function joinWhere($table, $first, $operator, $second, $type = 'inner')
    {
        return $this->join($table, $first, $operator, $second, $type, true);
    }

    /**
     * Add a subquery join clause to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @param  string  $as
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @param  string  $type
     * @param  bool  $where
     * @return $this
     *
     * @throws \InvalidArgumentException
     */
    public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false)
    {
        [$query, $bindings] = $this->createSub($query);

        $expression = '('.$query.') as '.$this->grammar->wrapTable($as);

        $this->addBinding($bindings, 'join');

        return $this->join(new Expression($expression), $first, $operator, $second, $type, $where);
    }

    /**
     * Add a lateral join clause to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @return $this
     */
    public function joinLateral($query, string $as, string $type = 'inner')
    {
        [$query, $bindings] = $this->createSub($query);

        $expression = '('.$query.') as '.$this->grammar->wrapTable($as);

        $this->addBinding($bindings, 'join');

        $this->joins[] = $this->newJoinLateralClause($this, $type, new Expression($expression));

        return $this;
    }

    /**
     * Add a lateral left join to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @return $this
     */
    public function leftJoinLateral($query, string $as)
    {
        return $this->joinLateral($query, $as, 'left');
    }

    /**
     * Add a left join to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @return $this
     */
    public function leftJoin($table, $first, $operator = null, $second = null)
    {
        return $this->join($table, $first, $operator, $second, 'left');
    }

    /**
     * Add a "join where" clause to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @return $this
     */
    public function leftJoinWhere($table, $first, $operator, $second)
    {
        return $this->joinWhere($table, $first, $operator, $second, 'left');
    }

    /**
     * Add a subquery left join to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @param  string  $as
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @return $this
     */
    public function leftJoinSub($query, $as, $first, $operator = null, $second = null)
    {
        return $this->joinSub($query, $as, $first, $operator, $second, 'left');
    }

    /**
     * Add a right join to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|string  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @return $this
     */
    public function rightJoin($table, $first, $operator = null, $second = null)
    {
        return $this->join($table, $first, $operator, $second, 'right');
    }

    /**
     * Add a "right join where" clause to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $second
     * @return $this
     */
    public function rightJoinWhere($table, $first, $operator, $second)
    {
        return $this->joinWhere($table, $first, $operator, $second, 'right');
    }

    /**
     * Add a subquery right join to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @param  string  $as
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @return $this
     */
    public function rightJoinSub($query, $as, $first, $operator = null, $second = null)
    {
        return $this->joinSub($query, $as, $first, $operator, $second, 'right');
    }

    /**
     * Add a "cross join" clause to the query.
     *
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @param  \Closure|\Illuminate\Contracts\Database\Query\Expression|string|null  $first
     * @param  string|null  $operator
     * @param  \Illuminate\Contracts\Database\Query\Expression|string|null  $second
     * @return $this
     */
    public function crossJoin($table, $first = null, $operator = null, $second = null)
    {
        if ($first) {
            return $this->join($table, $first, $operator, $second, 'cross');
        }

        $this->joins[] = $this->newJoinClause($this, 'cross', $table);

        return $this;
    }

    /**
     * Add a subquery cross join to the query.
     *
     * @param  \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<*>|string  $query
     * @param  string  $as
     * @return $this
     */
    public function crossJoinSub($query, $as)
    {
        [$query, $bindings] = $this->createSub($query);

        $expression = '('.$query.') as '.$this->grammar->wrapTable($as);

        $this->addBinding($bindings, 'join');

        $this->joins[] = $this->newJoinClause($this, 'cross', new Expression($expression));

        return $this;
    }

    /**
     * Get a new join clause.
     *
     * @param  string  $type
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @return \Illuminate\Database\Query\JoinClause
     */
    protected function newJoinClause(self $parentQuery, $type, $table)
    {
        return new JoinClause($parentQuery, $type, $table);
    }

    /**
     * Get a new join lateral clause.
     *
     * @param  string  $type
     * @param  \Illuminate\Contracts\Database\Query\Expression|string  $table
     * @return \Illuminate\Database\Query\JoinLateralClause
     */
    protected function newJoinLateralClause(self $parentQuery, $type, $table)
    {
        return new JoinLateralClause($parentQuery, $type, $table);
    }

    /**
     * Merge an array of where clauses and bindings.
     *
     * @param  array  $wheres
     * @param  array  $bindings
     * @return $this
     */
    public function mergeWheres($wheres, $bindings)
    {
        $this->wheres = array_merge($this->wheres, (array) $wheres);

        $this->bindings['where'] = array_values(
            array_merge($this->bindings['where'], (array) $bindings)
        );

        return $this;
    }

    /**
     * Add a basic where clause to the query.
     *
     * @param  \Closure|string|array|\Illuminate\Contracts\Database\Query\Expression  $column
     * @param  mixed  $operator
     * @param  mixed  $value
     * @param  string  $boolean
     * @return $this
     */
    public function where($column, $operator = null, $value = null, $boolean = 'and')
    {
        if ($column instanceof ConditionExpression) {
            $type = 'Expression';

            $this->wheres[] = compact('type', 'column', 'boolean');

            return $this;
        }

        // If the column is an array, we will assume it is an array of key-value pairs
        // and can add them each as a where clause. We will maintain the boolean we
        // received when the method was called and pass it into the nested where.
        if (is_array($column)) {
            return $this->addArrayOfWheres($column, $boolean);
        }

        // Here we will make some assumptions about the operator. If only 2 values are
        // passed to the method, we will assume that the operator is an equals sign
        // and keep going. Otherwise, we'll require the operator to be passed in.
        [$value, $operator] = $this->prepareValueAndOperator(
            $value, $operator, func_num_args() === 2
        );

        // If the column is actually a Closure instance, we will assume the developer
        // wants to begin a nested where statement which is wrapped in parentheses.
        // We will add that Closure to the query and return back out immediately.
        if ($column instanceof Closure && is_null($operator)) {
            return $this->whereNested($column, $boolean);
        }

        // If the column is a Closure instance and there is an operator value, we will
        // assume the developer wants to run a subquery and then compare the result
        // of that subquery with the given value that was provided to the method.
        if ($this->isQueryable($column) && ! is_null($operator)) {
            [$sub, $bindings] = $this->createSub($column);

            return $this->addBinding($bindings, 'where')
                ->where(new Expression('('.$sub.')'), $operator, $value, $boolean);
        }

        // If the given operator is not found in the list of valid operators we will
        // assume that the developer is just short-cutting the '=' operators and
        // we will set the operators to '=' and set the values appropriately.
        if ($this->invalidOperator($operator)) {
            [$value, $operator] = [$operator, '='];
        }

        // If the value is a Closure, it means the developer is performing an entire
        // sub-select within the query and we will need to compile the sub-select
        // within the where clause to get the appropriate query record results.
        if ($this->isQueryable($value)) {
            return $this->whereSub($column, $operator, $value, $boolean);
        }

        // If the value is "null", we will just assume the developer wants to add a
        // where null clause to the query. So, we will allow a short-cut here to
        // that method for convenience so the developer doesn't have to check.
        if (is_null($value)) {
            return $this->whereNull($column, $boolean, $operator !== '=');
        }

        $type = 'Basic';

        $columnString = ($column instanceof ExpressionContract)
            ? $this->grammar->getValue($column)
            : $column;

        // If the column is making a JSON reference we'll check to see if the value
        // is a boolean. If it is, we'll add the raw boolean string as an actual
        // value to the query to ensure this is properly handled by the query.
        if (str_contains($columnString, '->') && is_bool($value)) {
            $value = new Expression($value ? 'true' : 'false');

            if (is_string($column)) {
                $type = 'JsonBoolean';
            }
        }

        if ($this->isBitwiseOperator($operator)) {
            $type = 'Bitwise';
        }

        // Now that we are working with just a simple query we can put the elements
        // in our array and add the query binding to our array of bindings that
        // will be bound to each SQL statements when it is finally executed.
        $this->wheres[] = compact