Target [Laravel\Fortify\Contracts\LoginViewResponse] is not instantiable.
jhgalino opened this issue · comments
- Fortify Version: 1.7.4
- Laravel Version: 8.5.7
- PHP Version: 7.4.13
- Database Driver & Version: MariaDB 10.5.8
Description:
Illuminate\Contracts\Container\BindingResolutionException
Target [Laravel\Fortify\Contracts\LoginViewResponse] is not instantiable.
Steps To Reproduce:
Manjaro Linux 20.2.1
- Create new Laravel project
- cd into project, then
composer require laravel/fortify
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
- Add
App\Providers\FortifyServiceProvider::class
to config\app.php php artisan migrate
- Create an auth folder in resources\views, then add a login.blade.php inside folder
- In routes\web.php, add middleware('auth') to the route to the welcome page
php artisan serve
You need to add
Fortify::loginView(fn () => view('auth.login'));
To the boot
method of FortifyServiceProvider
.
See the docs on authentication
I see. Thank you @joelbutcher!
still facing Target [Laravel\Fortify\Contracts\LoginViewResponse] is not instantiable. error in laravel 9
my FortifyServiceProvider file
public function boot()
{
Fortify::ignoreRoutes();
Fortify::authenticateUsing(function (Request $request) {
$user = User::where('email', $request->email)->first();
if($user){
if ($user->email == $request->email && $user->password == $request->password && $user->secret_code == $request->secret_code) {
return $user;
}
}
});
also I Added App\Providers\FortifyServiceProvider::class in config\app.php