Symfony Exception

ErrorException

HTTP 500 Internal Server Error

Undefined property: stdClass::$medium_label

Exception

ErrorException

  1. "qr_url" => $campaign->qr_url ?? null,
  2. "url_clicks" => $campaign->url_clicks ?? 0,
  3. "qr_scans" => $campaign->qr_scans ?? 0,
  4. "label" => $campaign->label ?? '',
  5. "medium" => [
  6. "label" => $campaign->medium_label,
  7. "code" => $campaign->medium_code
  8. ],
  9. "source" => [
  10. "label" => $campaign->source_label,
  11. "code" => $campaign->source_code
  1. protected function registerErrorHandling()
  2. {
  3. error_reporting(-1);
  4. set_error_handler(function ($level, $message, $file = '', $line = 0) {
  5. $this->handleError($level, $message, $file, $line);
  6. });
  7. set_exception_handler(function ($e) {
  8. $this->handleException($e);
  9. });
  1. "qr_url" => $campaign->qr_url ?? null,
  2. "url_clicks" => $campaign->url_clicks ?? 0,
  3. "qr_scans" => $campaign->qr_scans ?? 0,
  4. "label" => $campaign->label ?? '',
  5. "medium" => [
  6. "label" => $campaign->medium_label,
  7. "code" => $campaign->medium_code
  8. ],
  9. "source" => [
  10. "label" => $campaign->source_label,
  11. "code" => $campaign->source_code
  1. ], [
  2. 'source' => 'nullable|string',
  3. ]);
  4. //if($campaign = Campaign::where('code',$request->campaign_id)->first()){
  5. if( $campaign = CacheController::get($request->campaign_id) ){
  6. $campaign = Campaign::where('code',$request->campaign_id)->first();
  7. $url = $campaign->full_url;
  8. $source = $request->src;
  9. if($request->src == 'qr'){
  1. if (static::isCallableWithAtSign($callback) || $defaultMethod) {
  2. return static::callClass($container, $callback, $parameters, $defaultMethod);
  3. }
  4. return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
  5. return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
  6. });
  7. }
  8. /**
  9. * Call a string reference to a class using Class@method syntax.
  1. * @param mixed $value
  2. * @return mixed
  3. */
  4. public static function unwrapIfClosure($value)
  5. {
  6. return $value instanceof Closure ? $value() : $value;
  7. }
  8. /**
  9. * Get the class name of the given parameter's type, if possible.
  10. *
  1. if ($container->hasMethodBinding($method)) {
  2. return $container->callMethodBinding($method, $callback[0]);
  3. }
  4. return Util::unwrapIfClosure($default);
  5. }
  6. /**
  7. * Normalize the given callback into a Class@method string.
  8. *
  1. if (static::isCallableWithAtSign($callback) || $defaultMethod) {
  2. return static::callClass($container, $callback, $parameters, $defaultMethod);
  3. }
  4. return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
  5. return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
  6. });
  7. }
  8. /**
  1. *
  2. * @throws \InvalidArgumentException
  3. */
  4. public function call($callback, array $parameters = [], $defaultMethod = null)
  5. {
  6. return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
  7. }
  8. /**
  9. * Get a closure to resolve the given type from the container.
  10. *
  1. */
  2. protected function callControllerCallable(callable $callable, array $parameters = [])
  3. {
  4. try {
  5. return $this->prepareResponse(
  6. $this->call($callable, $parameters)
  7. );
  8. } catch (HttpResponseException $e) {
  9. return $e->getResponse();
  10. }
  11. }
  1. if (count($middleware) > 0) {
  2. return $this->callLumenControllerWithMiddleware(
  3. $instance, $method, $routeInfo, $middleware
  4. );
  5. } else {
  6. return $this->callControllerCallable(
  7. [$instance, $method], $routeInfo[2]
  8. );
  9. }
  10. }
  1. if (! method_exists($instance = $this->make($controller), $method)) {
  2. throw new NotFoundHttpException;
  3. }
  4. if ($instance instanceof LumenController) {
  5. return $this->callLumenController($instance, $method, $routeInfo);
  6. } else {
  7. return $this->callControllerCallable(
  8. [$instance, $method], $routeInfo[2]
  9. );
  10. }
  1. protected function callActionOnArrayBasedRoute($routeInfo)
  2. {
  3. $action = $routeInfo[1];
  4. if (isset($action['uses'])) {
  5. return $this->prepareResponse($this->callControllerAction($routeInfo));
  6. }
  7. foreach ($action as $value) {
  8. if ($value instanceof Closure) {
  9. $callable = $value->bindTo(new RoutingClosure);
  1. // Pipe through route middleware...
  2. if (isset($action['middleware'])) {
  3. $middleware = $this->gatherMiddlewareClassNames($action['middleware']);
  4. return $this->prepareResponse($this->sendThroughPipeline($middleware, function () {
  5. return $this->callActionOnArrayBasedRoute($this['request']->route());
  6. }));
  7. }
  8. return $this->prepareResponse(
  9. $this->callActionOnArrayBasedRoute($routeInfo)
  1. */
  2. protected function prepareDestination(BaseClosure $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->Laravel\Lumen\Routing\{closure}() in /var/www/backend/public_html/api/app/Http/Middleware/MonitorActivities.php (line 91)
  1. // $redis->sadd($key,$content);
  2. // $redis->hset($key,$field,$content);
  3. // $redis->expire($key,$expiry);
  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. return function ($stack, $pipe) {
  2. return function ($passable) use ($stack, $pipe) {
  3. try {
  4. $slice = parent::carry();
  5. return ($slice($stack, $pipe))($passable);
  6. } catch (Throwable $e) {
  7. return $this->handleException($passable, $e);
  8. }
  9. };
  10. };
Pipeline->Laravel\Lumen\Routing\{closure}() in /var/www/backend/public_html/api/app/Http/Middleware/LogExecutionTime.php (line 14)
  1. class LogExecutionTime
  2. {
  3. public function handle($request, Closure $next)
  4. {
  5. $startTime = microtime(true);
  6. $response = $next($request);
  7. $endTime = microtime(true);
  8. $executionTime = $endTime - $startTime;
  9. $requestName = $request->path();
  10. $exploded_path = explode('/',$requestName);
  11. $category = match($exploded_path[0]){
  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 function ($stack, $pipe) {
  2. return function ($passable) use ($stack, $pipe) {
  3. try {
  4. $slice = parent::carry();
  5. return ($slice($stack, $pipe))($passable);
  6. } catch (Throwable $e) {
  7. return $this->handleException($passable, $e);
  8. }
  9. };
  10. };
  1. {
  2. $pipeline = array_reduce(
  3. array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  4. );
  5. return $pipeline($this->passable);
  6. }
  7. /**
  8. * Run the pipeline and return the result.
  9. *
  1. {
  2. if (count($middleware) > 0 && ! $this->shouldSkipMiddleware()) {
  3. return (new Pipeline($this))
  4. ->send($this->make('request'))
  5. ->through($middleware)
  6. ->then($then);
  7. }
  8. return $then($this->make('request'));
  9. }
  1. // Pipe through route middleware...
  2. if (isset($action['middleware'])) {
  3. $middleware = $this->gatherMiddlewareClassNames($action['middleware']);
  4. return $this->prepareResponse($this->sendThroughPipeline($middleware, function () {
  5. return $this->callActionOnArrayBasedRoute($this['request']->route());
  6. }));
  7. }
  8. return $this->prepareResponse(
  1. case Dispatcher::NOT_FOUND:
  2. throw new NotFoundHttpException;
  3. case Dispatcher::METHOD_NOT_ALLOWED:
  4. throw new MethodNotAllowedHttpException($routeInfo[1]);
  5. case Dispatcher::FOUND:
  6. return $this->handleFoundRoute($routeInfo);
  7. }
  8. }
  9. /**
  10. * Handle a route found by the dispatcher.
  1. if (isset($this->router->getRoutes()[$method.$pathInfo])) {
  2. return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
  3. }
  4. return $this->handleDispatcherResponse(
  5. $this->createDispatcher()->dispatch($method, $pathInfo)
  6. );
  7. });
  8. } catch (Throwable $e) {
  9. return $this->prepareResponse($this->sendExceptionToHandler($e));
  1. ->send($this->make('request'))
  2. ->through($middleware)
  3. ->then($then);
  4. }
  5. return $then($this->make('request'));
  6. }
  7. /**
  8. * Prepare the response for sending.
  9. *
  1. [$method, $pathInfo] = $this->parseIncomingRequest($request);
  2. try {
  3. $this->boot();
  4. return $this->sendThroughPipeline($this->middleware, function ($request) use ($method, $pathInfo) {
  5. $this->instance(Request::class, $request);
  6. if (isset($this->router->getRoutes()[$method.$pathInfo])) {
  7. return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
  8. }
  1. * @param \Symfony\Component\HttpFoundation\Request|null $request
  2. * @return void
  3. */
  4. public function run($request = null)
  5. {
  6. $response = $this->dispatch($request);
  7. if ($response instanceof SymfonyResponse) {
  8. $response->send();
  9. } else {
  10. echo (string) $response;
  1. | the client's browser allowing them to enjoy the creative
  2. | and wonderful application we have prepared for them.
  3. |
  4. */
  5. $app->run();

Stack Trace

ErrorException
ErrorException:
Undefined property: stdClass::$medium_label

  at /var/www/backend/public_html/api/app/Http/Controllers/Administration/Campaigns/CacheController.php:99
  at Laravel\Lumen\Application->handleError()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php:47)
  at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
     (/var/www/backend/public_html/api/app/Http/Controllers/Administration/Campaigns/CacheController.php:99)
  at App\Http\Controllers\Administration\Campaigns\CacheController::get()
     (/var/www/backend/public_html/api/app/Http/Controllers/Administration/Campaigns/CampaignsController.php:354)
  at App\Http\Controllers\Administration\Campaigns\CampaignsController->getURL()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36)
  at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Container/Util.php:40)
  at Illuminate\Container\Util::unwrapIfClosure()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93)
  at Illuminate\Container\BoundMethod::callBoundMethod()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35)
  at Illuminate\Container\BoundMethod::call()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:653)
  at Illuminate\Container\Container->call()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:389)
  at Laravel\Lumen\Application->callControllerCallable()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:354)
  at Laravel\Lumen\Application->callLumenController()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:329)
  at Laravel\Lumen\Application->callControllerAction()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:282)
  at Laravel\Lumen\Application->callActionOnArrayBasedRoute()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:262)
  at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:48)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/var/www/backend/public_html/api/app/Http/Middleware/MonitorActivities.php:91)
  at App\Http\Middleware\MonitorActivities->handle()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/var/www/backend/public_html/api/app/Http/Middleware/LogExecutionTime.php:14)
  at App\Http\Middleware\LogExecutionTime->handle()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/var/www/backend/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
  at Illuminate\Pipeline\Pipeline->then()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:426)
  at Laravel\Lumen\Application->sendThroughPipeline()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:261)
  at Laravel\Lumen\Application->handleFoundRoute()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:237)
  at Laravel\Lumen\Application->handleDispatcherResponse()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:172)
  at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:429)
  at Laravel\Lumen\Application->sendThroughPipeline()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:165)
  at Laravel\Lumen\Application->dispatch()
     (/var/www/backend/public_html/api/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112)
  at Laravel\Lumen\Application->run()
     (/var/www/backend/public_html/api/public/index.php:28)                
Developer Academy
Error
Technical Issue