I want to mark a notification as read for a user who views a particular post
public function show(Post $post)
{
$notification_for_user = auth()->user()->unreadNotifications()->where("data['post_id']", $post->id)->first()->update(['read_at' => now()]);
return view('post.show', compact('post'));
}
It gives this error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data['post_id']' in 'where clause'
So how can i access data column's post_id to delete that particular notification for the user when it is displayed.
This is how it is stored in data column
{"post_id":8,"title":"Example Post...}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2B9iVPw
via IFTTT
Aucun commentaire:
Enregistrer un commentaire