Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

target [Laravel\Fortify\Contracts\RegisterViewResponse] is not instantiable

i'm have a router register but i found error

Target [Laravel\Fortify\Contracts\RegisterViewResponse] is not instantiable.

like image 283
Riki krismawan Avatar asked Feb 02 '21 05:02

Riki krismawan


2 Answers

You need to register fortify service provider inside the config/app.php files

Add this

App\Providers\FortifyServiceProvider::class,

to config/app.php under the Application's Service Providers.

Update : It is also important you point the location of your authentication views to Fortify.

An example for the Register view would be:


//  auth.register => means your register.blade is located in `view/auth/`
//  folder. (All things being equal)

Fortify::registerView(function () {
    return view('auth.register');
});

Read More: https://laravel.com/docs/9.x/fortify#registration

like image 119
Joseph Ajibodu Avatar answered Nov 15 '22 21:11

Joseph Ajibodu


you have to add all these in FortifyServiceProvider.php at the boot method. then import all classes needed

Fortify::loginView(function(){
            return view('auth.login');
        });

        Fortify::authenticateUsing(function(Request $request){
            $user = User::where('email',$request->email)->first();
            if($user && Hash::check($request->password,$user->password)){
                return $user;
            }
        });
         Fortify::registerView(function(){
            return view('auth.register');
        });

after that you need to create the register and login view

like image 44
MHAMMED TALHAOUY Avatar answered Nov 15 '22 21:11

MHAMMED TALHAOUY