我要在注册后注销。我怎么做?
这是我的注册控制器:
protected function create(array $data)
{
$user = User::create([
'firstname' => $data['firstname'],
'secondname' => $data['secondname'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'address' => $data['address'],
'mobileno' => $data['mobileno'],
'type' => $data['type'],
]);
$verifyUser = VerifyUser::create([
'user_id' => $user->id,
'token' => str_random(40)
]);
Mail::to($user->email)->send(new VerifyMail($user));
return $user;
return redirect('/login')->with('status', 'We sent you an activation code. Check your email and click on the link to verify.');
}
答案 0 :(得分:0)
在控制器中添加这两行并检查
public function __construct()
{
$this->middleware('auth');
}
答案 1 :(得分:0)
您可以更改网址:-
protected $redirectTo = '/where/you/want/to/redirect';
在app/Http/Controller/Auth/RegisterController.php
注册后
并注销:-
public function __construct()
{
$this->middleware('guest')->except('logout');
}