I have a Patient model with this function
public function store()
{
$create = Patient::create(request()->all());
$notification = User::find(1)->notify(new NewPatient);
return redirect('/patients')->with('success', 'Patient saved!.');
}
I have a Database notification called NewPatient.php with this method
public function toArray($notifiable)
{
return [
//
'data' => 'New patient has been created!'
];
}
Every time a new patient is created, i want to create a notification on the doctors's page(so that the doctor can treat that patient) showing the name of the Patient who has been created. Right now i successfully retrieve my notifications when a new patient is created on my view like so,
@if ( auth()->user()->unreadNotifications->count())
@foreach (auth()->user()->unreadNotifications as $unRead)
<li><a href="#" > </a></li>
@endforeach
@endif
I want the notification data to be the name of the newly created patient instead of my data in App\Notifications\NewPatient.php
but the problem is i dont how to pass the Controller other than in the Notification itself.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire