我具有以下实现,可以通过我的Laravel
应用程序发送邀请和通过电子邮件发送邀请。以前,新的DbRepository(DB::connection(), $table, $key, 60);
需要4个参数,但更新为 5.8 之后,我意识到他们添加了第五个参数DbRepository(DB::connection(), $hasher, $table, $key, 60);
我不知道如何创建Hasher $ hasher参数。
public function inviteUser(Request $data)
{
$user = User::find($data->id);
$userArray = $user->toArray();
// Create reset token
$table = 'myapp.password_resets';
$key = config('app.key');
$hash = Hash::make($data->id);
$dbRepo = new DbRepository(DB::connection(), null, $table, $key, 60);
$token = $dbRepo->create($user);
$emailData = array(
'name' => $userArray['name'],
'email' => $userArray['email'],
'token' => $token,
'admin_name' => Auth::user()->name,
'entity_name' => session('entity_name')
);
Mail::send('auth.emails.invite', $emailData, function ($message) use ($user) {
$message->to($user->email)->subject('You have been invited to use myApp!');
});
return '';
}