Я пытаюсь сделать так, чтобы каждый раз, когда новый Доктор регистрировался, он запускал уведомление Laravel, чтобы отправить мне электронное письмо.Вот мой текущий код:
Контроллер
$doctor = new Doctor();
$doctor->practice_id = $request->practice;
$doctor->first_name = $request->first_name;
$doctor->last_name = $request->last_name;
$doctor->type = $request->type;
$doctor->npi = $request->npi;
$doctor->license = $request->license;
$doctor->dea = $request->dea;
$doctor->is_approved = 0;
$doctor->is_ffs = 0;
$doctor->ffs_id = null;
$doctor->save();
Notification::route('mail', 'admin@test.com')->notify(new NewDoctor($doctor));
Уведомление NewDoctor
public function via($notifiable)
{
return ['mail'];
}
public function toMail($notifiable)
{
return (new MailMessage)
->greeting('Doctor Registered!')
->line('A new doctor has been submitted for approval.')
->action('View Doctor', route('doctors.show', [$this->doctor]));
}
Это возвращает следующееошибка: Undefined property: App\Notifications\NewDoctor::$doctor
Я предполагаю, что по какой-то причине doctor
id
просто не проходит, но я понятия не имею, как это сделать.