コード例 #1
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->query->has('ntf_read') && $this->auth->check()) {
         $id = $request->query->get('ntf_read');
         $id = hashids_decode($id);
         NotificationTarget::where('notification_id', $id)->where('user_id', $this->auth->id())->update(['read' => true]);
     }
     return $next($request);
 }
コード例 #2
0
 public function markAllAsRead()
 {
     NotificationTarget::where('user_id', Auth::id())->where('read', false)->update(['read' => true]);
     return Response::json(['status' => 'ok']);
 }