/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $user_id = Auth::user()->id; $notification = DB::table('notifications')->where('id', $id)->first(); if ($notification == null) { abort(404); } $author_id = $notification->user_id; if ($author_id != $user_id) { abort(401); } NotificationController::destroy($id); if ($notification->type == 0) { return redirect()->action('MessageController@show', ['id' => $notification->content_id]); } else { if ($notification->type == 1) { $thread = DB::table('threads')->where('id', $notification->content_id)->first(); if ($thread == null) { abort(404); } return redirect()->action('ThreadController@show', ['id' => $notification->content_id]); } } }