{
$articulos = Cache::get("articulos_eq_" . $articulo['equipo_id']);
$count = 0;
$data = [];
foreach ($articulos as $art) {
if($art['id'] != $articulo['id']) {
$data[] = $art;
$count++;
}
if($count == 6) break;
{
$articulos = Cache::get("articulos_eq_" . $articulo['equipo_id']);
$count = 0;
$data = [];
foreach ($articulos as $art) {
if($art['id'] != $articulo['id']) {
$data[] = $art;
$count++;
}
if($count == 6) break;
// ->orderBy('publicacion', 'DESC')
// ->take(6)
// ->get()
// ->toArray();
$relacionados = $this->_getRelacionados($articulo);
$agent = new Agent();
return view('show23', [
'articulo' => $articulo,
'relacionados' => $relacionados,
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
* @param mixed $value
* @return mixed
*/
public static function unwrapIfClosure($value)
{
return $value instanceof Closure ? $value() : $value;
}
/**
* Get the class name of the given parameter's type, if possible.
*
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return Util::unwrapIfClosure($default);
}
/**
* Normalize the given callback into a Class@method string.
*
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
*
* @throws \InvalidArgumentException
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
/**
* Get a closure to resolve the given type from the container.
*
*/
protected function callControllerCallable(callable $callable, array $parameters = [])
{
try {
return $this->prepareResponse(
$this->call($callable, $parameters)
);
} catch (HttpResponseException $e) {
return $e->getResponse();
}
}
return $this->callLumenControllerWithMiddleware(
$instance, $method, $routeInfo, $middleware
);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
}
/**
if (! method_exists($instance = $this->make($controller), $method)) {
throw new NotFoundHttpException;
}
if ($instance instanceof LumenController) {
return $this->callLumenController($instance, $method, $routeInfo);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
protected function callActionOnArrayBasedRoute($routeInfo)
{
$action = $routeInfo[1];
if (isset($action['uses'])) {
return $this->prepareResponse($this->callControllerAction($routeInfo));
}
foreach ($action as $value) {
if ($value instanceof Closure) {
$callable = $value->bindTo(new RoutingClosure);
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
}
/**
* Call the Closure or invokable on the array based route.
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException;
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
/**
* Handle a route found by the dispatcher.
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
*/
protected function prepareDestination(BaseClosure $destination)
{
return function ($passable) use ($destination) {
try {
return call_user_func($destination, $passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
}
if ($request->isMethod('OPTIONS'))
{
return response()->json('{"method":"OPTIONS"}', 200, $headers);
}
$response = $next($request);
foreach($headers as $key => $value)
{
//echo $key . ' ' . $value;
$response->header($key, $value);
}
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
return call_user_func($slice($stack, $pipe), $passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
{
$pipeline = array_reduce(
array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
);
return $pipeline($this->passable);
}
/**
* Run the pipeline and return the result.
*
{
if (count($middleware) > 0 && ! $this->shouldSkipMiddleware()) {
return (new Pipeline($this))
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
}
* @param SymfonyRequest|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
ErrorException
|
---|
ErrorException: Invalid argument supplied for foreach() at /home/mb/app/Http/Controllers/SiteController.php:180 at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() (/home/mb/app/Http/Controllers/SiteController.php:180) at App\Http\Controllers\SiteController->_getRelacionados() (/home/mb/app/Http/Controllers/SiteController.php:50) at App\Http\Controllers\SiteController->show() (/home/mb/vendor/illuminate/container/BoundMethod.php:36) at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() (/home/mb/vendor/illuminate/container/Util.php:37) at Illuminate\Container\Util::unwrapIfClosure() (/home/mb/vendor/illuminate/container/BoundMethod.php:93) at Illuminate\Container\BoundMethod::callBoundMethod() (/home/mb/vendor/illuminate/container/BoundMethod.php:37) at Illuminate\Container\BoundMethod::call() (/home/mb/vendor/illuminate/container/Container.php:596) at Illuminate\Container\Container->call() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:386) at Laravel\Lumen\Application->callControllerCallable() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:352) at Laravel\Lumen\Application->callLumenController() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:326) at Laravel\Lumen\Application->callControllerAction() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:279) at Laravel\Lumen\Application->callActionOnArrayBasedRoute() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:264) at Laravel\Lumen\Application->handleFoundRoute() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:234) at Laravel\Lumen\Application->handleDispatcherResponse() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:170) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() at call_user_func() (/home/mb/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:48) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/home/mb/app/Http/Middleware/CorsMiddleware.php:34) at App\Http\Middleware\CorsMiddleware->handle() (/home/mb/vendor/illuminate/pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() at call_user_func() (/home/mb/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/home/mb/vendor/illuminate/pipeline/Pipeline.php:103) at Illuminate\Pipeline\Pipeline->then() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:423) at Laravel\Lumen\Application->sendThroughPipeline() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:172) at Laravel\Lumen\Application->dispatch() (/home/mb/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:109) at Laravel\Lumen\Application->run() (/home/mb/public/index.php:27) |