简体   繁体   English

目标 [Laravel\Fortify\Contracts\RegisterViewResponse] 不可实例化

[英]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.目标 [Laravel\Fortify\Contracts\RegisterViewResponse] 不可实例化。

You need to register fortify service provider inside the config/app.php files您需要在config/app.php文件中注册强化服务提供者

Add this添加这个

App\Providers\FortifyServiceProvider::class,

to config/app.php under the Application's Service Providers.在应用程序的服务提供者下config/app.php

you have to add all these in FortifyServiceProvider.php at the boot method.您必须在引导方法中将所有这些添加到FortifyServiceProvider.php中。 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之后,您需要创建注册登录视图

Verify that the following providers are registered in the config.app file in the providers section验证以下提供程序是否已在providers部分的config.app文件中注册

App\Providers\FortifyServiceProvider::class,
App\Providers\JetstreamServiceProvider::class, // If using Jetstream

Uncomment the following line in the App\Providers\FortifyServiceProvider.php fileApp\Providers\FortifyServiceProvider.php文件中取消注释以下行

Fortify::createUsersUsing(CreateNewUser::class);

Make registerView function on app/providers/FortifyServiceProvider.php在 app/providers/FortifyServiceProvider.php 上注册查看 function

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

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

put this code in your fortyfive service provider folder under the book method将此代码放在 book 方法下的 45 个服务提供商文件夹中

In addition to Joseph Ajibodu's answer, within the boot method of FortifyServiceProvider add the following:除了Joseph Ajibodu 的回答,在FortifyServiceProvider的 boot 方法中添加以下内容:

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

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

    Fortify::requestPasswordResetLinkView(function () {
        return view('auth.forgot-password');
    });

    Fortify::resetPasswordView(function () {
        return view('auth.reset-password');
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel “目标 [Illuminate\\Contracts\\Bus\\Dispatcher] 不可实例化。” - Laravel "Target [Illuminate\Contracts\Bus\Dispatcher] is not instantiable." Laravel 5.8 目标 [Illuminate\Contracts\Debug\ExceptionHandler] 不可实例化 - Laravel 5.8 Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable Laravel 5目标不可实例化 - Laravel 5 target is not instantiable Laravel 4:目标接口不可实例化 - Laravel 4: Target Interface is not instantiable 目标 [Illuminate\\Contracts\\Debug\\ExceptionHandler] 不可实例化 - Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable 目标 [Illuminate\Contracts\Broadcasting\Factory] 不可实例化 - Target [Illuminate\Contracts\Broadcasting\Factory] is not instantiable Laravel 5.1:Auth::logout() 不起作用并且目标 [Illuminate\\Contracts\\Auth\\Registrar] 不是可实例化的错误 - Laravel 5.1: Auth::logout() is not working and Target [Illuminate\Contracts\Auth\Registrar] is not instantiable error Lumen + Socialite - Laravel\\Socialite\\Contracts\\Factory 不可实例化 - Lumen + Socialite - Laravel\Socialite\Contracts\Factory is not instantiable 目标接口不可实例化。 Laravel 4 - Target Interface is not instantiable. Laravel 4 Laravel:在构建时无法实例化目标 - Laravel: Target is not instantiable while building
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM