[英]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
file在
App\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.