public function __construct() { $dispatchers = app()->getCollector()->getDispatcherCollection(); parent::__construct(app()->getCollector()->getRoutes(), new DispatcherResolver($dispatchers)); $this->getRouteCollection()->notFound(function ($path) { return new NotFound(view('error.404', array('path' => $path))); })->accessDenied(function ($path) { return new AccessDenied(view('error.403', array('path' => $path))); }); }
/** * Constructor * * @param \Opis\Colibri\Application $app */ public function __construct(Application $app) { $this->app = $app; $specials = array('app' => $app, 'request' => $app->request(), 'response' => $app->response(), 't' => $app->getTranslator(), 'lang' => $app->getTranslator()->getLanguage(), 'view' => $app->getViewRouter()); parent::__construct($app->collect('Routes'), $app->collect('Dispatchers'), null, $specials); $this->getRouteCollection()->notFound(function ($path) use($app) { return new NotFound($app->view('error.404', array('path' => $path))); })->accessDenied(function ($path) use($app) { return new AccessDenied($app->view('error.403', array('path' => $path))); }); $this->getRouteCollection()->setRouter($this); }