我想在成功注册后我被重定向到successfull.blade.php
,但由于某种原因,它要么给出 404 错误,找不到页面,要么它总是把我扔到家......我无法处理它,请帮助我。 注册成功后,我应该被扔到successfull.blade.php
请帮助我。
注册用户.php
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
return $this->registered($request, $user)
?: redirect()->to('/successfull');
}
寄存器控制器
protected function redirectPath()
{
if (Auth::user()->role_id==NULL) {
return '/successfull';
} else {
return '/successfull';
}
}
网络.php
Auth::routes();
Route::get('/home', 'HomeController@getUser')->name('users');
Route::get('/successfull', 'AuthRegisterController@redirectPath');
主控制器
public function getUser(){
$user=auth()->user();
return view('home',[
'users' => $user,
]);
}
因为homecontroller
把我扔到home
,但我希望它只在登录后,注册后我需要重定向到另一个文件
路由:define
HomeController
中名为success
的新function
,并在函数内调用success.blade.php
。
Route::get('/successfull', 'HomeController@success');
寄存器控制器
if (Auth::user()->role_id != NULL) {
return redirect('/successfull');
}
注册用户.php
成功创建用户帐户后
redirect('/successfull')->withSuccess(' Account Created Successfully');
希望它能帮助你:)