/**
* {@inheritdoc}
*/
public function register()
{
$this->app->singleton(UrlGenerator::class, function () {
return new UrlGenerator($this->app, $this->app->make('flarum.api.routes'));
});
$this->app->singleton('flarum.api.routes', function () {
return $this->getRoutes();
});
$this->app->singleton(ErrorHandler::class, function () {
$handler = new ErrorHandler();
$handler->registerHandler(new Handler\FloodingExceptionHandler());
$handler->registerHandler(new Handler\IlluminateValidationExceptionHandler());
$handler->registerHandler(new Handler\InvalidConfirmationTokenExceptionHandler());
$handler->registerHandler(new Handler\ModelNotFoundExceptionHandler());
$handler->registerHandler(new Handler\PermissionDeniedExceptionHandler());
$handler->registerHandler(new Handler\ValidationExceptionHandler());
$handler->registerHandler(new InvalidParameterExceptionHandler());
$handler->registerHandler(new FallbackExceptionHandler($this->app->inDebugMode()));
return $handler;
});
}