/** * register the provider * * @return mixed */ public function register() { App::bind('route.not.found', function () { App::abort(404, 'Page Not Found'); }); App::bind('route.middleware.failed', function () { throw new MiddlewareException('You can\'t access here, your authority is incorrect'); }); }
/** * throw an http exception with given datas * * @param int $code * @param string $message * @param array $headers * @throws HttpException */ function abort($code = 503, $message = '', array $headers = []) { App::abort($code, $message, $headers); }