public function down(Closure $callback)
{
$this['events']->listen('illuminate.app.down', $callback);
}
public function abort($code, $message = '', array $headers = array())
{
if ($code == 404) {
throw new NotFoundHttpException($message);
} else {
throw new HttpException($code, $message, null, $headers);
$instance = static::resolveFacadeInstance(static::getFacadeAccessor());
switch (count($args)) {
case 0:
return $instance->{$method}();
case 1:
return $instance->{$method}($args[0]);
case 2:
return $instance->{$method}($args[0], $args[1]);
case 3:
return $instance->{$method}($args[0], $args[1], $args[2]);
$category = Category::whereSlug($slug)
->locale()
->whereIn('parent_id', $parents)
->first(['title', 'slug', 'lft', 'rgt', 'depth', 'elements.id', 'data']);
}
if (count($category) == 0) {
App::abort(404, 'No page found. HINT: Category');
}
// Slug length is 1 => could be from root or from _hidden
if (! isset($slugs[1])) {
return $this->root($slugs[0]);
}
// Slug length is bigger than 1 => we must do a loop through all the slugs and define the category
return $this->page();
}
*
* @param string $method
* @param array $parameters
* @return mixed
*/
protected function callMethod($method, $parameters)
{
return call_user_func_array(array($this, $method), $parameters);
}
// after filters on the controller to wrap up any last minute processing.
$response = $this->callBeforeFilters($router, $method);
$this->setupLayout();
if (is_null($response))
{
$response = $this->callMethod($method, $parameters);
}
$ioc = $this->container;
$me = $this;
return function () use($me, $ioc, $attribute) {
list($controller, $method) = explode('@', $attribute);
$route = $me->getCurrentRoute();
$args = array_values($route->getParametersWithoutDefaults());
$instance = $ioc->make($controller);
return $instance->callAction($ioc, $me, $method, $args);
};
}
$this->callAfterFilters($request, $response);
}
return $response;
}
protected function callCallable()
{
$variables = array_values($this->getParametersWithoutDefaults());
return call_user_func_array($this->getOption('_call'), $variables);
}
protected function callBeforeFilters(Request $request)
protected $parameters;
protected $parsedParameters;
public function run(Request $request)
{
$this->parsedParameters = null;
$response = $this->callBeforeFilters($request);
if (!isset($response)) {
$response = $this->callCallable();
} else {
$fromFilter = true;
{
$this->currentRequest = $request;
$response = $this->callGlobalFilter($request, 'before');
if (!is_null($response)) {
$response = $this->prepare($response, $request);
} else {
$this->currentRoute = $route = $this->findRoute($request);
$response = $route->run($request);
}
$this->callAfterFilter($request, $response);
{
if ($this->isDownForMaintenance()) {
$response = $this['events']->until('illuminate.app.down');
if (!is_null($response)) {
return $this->prepareResponse($response, $request);
}
}
return $this['router']->dispatch($this->prepareRequest($request));
}
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
$this->fireAppCallbacks($this->shutdownCallbacks);
} else {
$this->shutdownCallbacks[] = $callback;
}
}
public function run()
{
$response = $this->dispatch($this['request']);
$this['router']->callCloseFilter($this['request'], $response);
$response->send();
| Once we have the application, we can simply call the run method,
| which will execute the request and send the response back to
| the client's browser allowing them to enjoy the creative
| and wonderful applications we have created for them.
|
*/
$app->run();
/*