I was saved my notification into database like this:
public function toDatabase($notifiable)
{
return [
'from' => $this->message->name,
'name'=> $this->message->email,
'subject' => $this->message->subject,
'body' => $this->message->body
];
}
it work fine. Now i want to extract that data into my view, so i do like this:
@foreach ( Auth::user()->unreadNotifications as $notification)
<li><!-- start message -->
<a href="#">
<!-- Message title and timestamp -->
<h4>
{{ $notification->name }}
<small><i class="fa fa-clock-o"></i> 5 mins</small>
</h4>
<!-- The message -->
<p>{{ $notification->subject }}</p>
</a>
</li>
@endforeach
but it give me nothing. so am i do it wrongly?
@php dd($notification) @endphp
inside your foreach loop. – Latarsha