public function markAllAsRead() { $user = Auth::user(); $notif = Notifikasi::where('action_to', '=', $user->id)->get(); foreach ($notif as $nt) { $nt->status = 'read'; $nt->update(); } }
public function deleteAll() { $user = Auth::user(); $notif = Notifikasi::where('action_to', '=', $user->id)->get(); foreach ($notif as $nt) { $n = Notifikasi::find($nt->id); if ($n) { $n->delete(); } } }
public static function getAllNotifForMe($user_id) { $notif = Notifikasi::where('action_to', '=', $user_id)->orderBy('created_at', 'desc')->get(); return $notif; }