用户注册后,我需要提供一个用户可以用来重新发送注册的链接.
由于我必须在链接中传递令牌,我将如何生成该令牌?
ex: http://dmain.com/account/confirm/resend/:token
另外,在RegistersUsers中
public function register(RegisterRequest $request)
{
if (config('access.users.confirm_email')) {
$user = $this->user->create($request->all());
event(new UserRegistered($user));
return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend'));
} else {
auth()->login($this->user->create($request->all()));
event(new UserRegistered(access()->user()));
return redirect($this->redirectPath());
}
}
因此,链接生成为:
return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend'));
我如何将令牌传递给trans?
'resend' => 'Your account is not confirmed. Please click the confirmation link in your e-mail, or <a href="' . route('account.confirm.resend', ':token') . '">click here</a> to resend the confirmation e-mail.',
最佳答案 我发现如何通过将变量作为数组传递来执行此操作:
return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend', array('token' => $token)));