У меня есть этот метод в моем контроллере
public function update(UserUpdateRequest $request)
{
$request->user()->update([
'name' => $request->username,
]);
Mail::to($request->user())->send(
new UserUpdated( $request->user() )
);
return redirect()->route('account.index');
}
Поэтому, когда пользователь обновляет имя пользователя, отправляется электронное письмо
public $user;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->markdown('emails.user.updated');
}
И это шаблон электронной почты
Hi {{ $user->username }},
We would like to inform you that your username has been updated successfully.
If this action wasn't done by you, you need to contact with our support.
Но это вызывает исключение в очередях
ErrorException: неопределенная переменная: пользователь в / storage / framework / views /
Любые идеи, чтоЯ делаю не так?