public function replydelete() { $id = Input::get('id'); $reply_id = Input::get('reply_id'); $data = Reply::where('id', '=', $id)->where('itemId', '=', $reply_id)->delete(); return Redirect::to('seven'); }
public function destroy($id) { $topic = Topic::findOrFail($id); $this->authorOrAdminPermissioinRequire($topic->user_id); //删除文章 $topic->delete(); //该文章相关的通知删除 Notification::where('user_id', '=', $topic->user_id)->where('topic_id', '=', $topic->id)->delete(); //该文章的回复删除 Reply::where('topic_id', '=', $topic->id)->delete(); Flash::success(lang('Operation succeeded.')); $url = Request::getRequestUri(); if (stripos($url, 'account') == false) { return Redirect::route('topics.index'); } else { return Redirect::route('ac_topices'); } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $chat = Chat::find($id); if (!isset($chat)) { return Redirect::to('/community/chats')->with('flash_chat', 'That chat doesn\'t exist!')->with('alert_class', 'alert-danger'); } $users = $chat->user->all(); //If the user isn't part of the conversation, don't let them view it $inArray = false; foreach ($users as $user) { if ($user->id == Auth::user()->id) { $inArray = true; } } if (!$inArray) { return Redirect::to('/community/chats')->with('flash_chat', 'You don\'t have permission to view this chat')->with('alert_class', 'alert-danger'); } $replies = Reply::where('chat_id', '=', $chat->id)->get(); foreach ($replies as $reply) { $notification = Notification::where('user_id', '=', Auth::user()->id)->where('reply_id', '=', $reply->id)->firstOrFail(); $notification->has_read = 1; $notification->save(); } return View::make('readOneChat')->with(array('chat' => $chat, 'users' => $chat->getOtherUsers(), 'replies' => $replies)); }