这是注册的
{
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'avatar' => '/images/avatar/default.png',
'confirmation_token' => str_random(40),
'password' => bcrypt($data['password']),
]);
$this->sendVerifyEmailTo($user);
return $user;
}
private function sendVerifyEmailTo($user)
{
$data = ['url' => route('email.verify',['token'=> $user ->confirmation_token]),
'name' => $user->name
];
$template = new SendCloudTemplate('register', $data);
Mail::raw($template, function ($message) use ($user) {
$message->from('[email protected]', 'hybridword ');
$message->to($user->email);
});
}```
这是激活的,顺便提一下,他是激活成功的了
{
$user = User::where('confirmation_token',$token)->first();
if (is_null($user)){
return redirect('/');
}
$user->is_active = 1 ;
$user->confirmation_token =str_random(40);
$user->save();
Auth::login();
return redirect('/home');
}```