Target [Illuminate\Contracts\Routing\ResponseFactory] is not instantiable on calling Response::json using Response Facade in Lumen 5.4.3
Here's the error
in Container.php line 804
at Container->notInstantiable('Illuminate\\Contracts\\Routing\\ResponseFactory') in Container.php line 687
at Container->build('Illuminate\\Contracts\\Routing\\ResponseFactory') in Container.php line 565
at Container->make('Illuminate\\Contracts\\Routing\\ResponseFactory') in Application.php line 208
at Application->make('Illuminate\\Contracts\\Routing\\ResponseFactory') in Container.php line 1070
at Container->offsetGet('Illuminate\\Contracts\\Routing\\ResponseFactory') in Facade.php line 159
at Facade::resolveFacadeInstance('Illuminate\\Contracts\\Routing\\ResponseFactory') in Facade.php line 128
at Facade::getFacadeRoot() in Facade.php line 215
at Facade::__callStatic('json', array(array(***))) in AppResponse.php line 31
Found a fix from tymondesigns/jwt-auth#532
In bootstrap/app.php uncomment this line
$app->register(App\Providers\AppServiceProvider::class);
In the file App\Providers\AppServiceProvider update the register method to add:
/**
* Register any application services.
*/
public function register()
{
// ...
$this->app->singleton('Illuminate\Contracts\Routing\ResponseFactory', function ($app) {
return new \Illuminate\Routing\ResponseFactory(
$app['Illuminate\Contracts\View\Factory'],
$app['Illuminate\Routing\Redirector']
);
});
// ...
}
No comments:
Post a Comment