示例#1
0
 public function editReply($id, EditReplyRequest $request)
 {
     $reply = Reply::findOrFail($id);
     $reply->update(['body' => $request->input('body'), 'editor_id' => \Auth::id(), 'editor_name' => \Auth::user()->name, 'was_edited' => 1, 'edit_reason' => $request->input('edit_reason')]);
     flash()->success('Udało Ci się edytować odpowiedź o ID <b>' . $id . '</b>!');
     return redirect('/forum/topic/' . $request->input('take_topic_id') . '');
 }
示例#2
0
 public function destroy($id)
 {
     $reply = Reply::findOrFail($id);
     $this->authorOrAdminPermissioinRequire($reply->user_id);
     $reply->delete();
     $reply->topic->decrement('reply_count', 1);
     Flash::success(lang('Operation succeeded.'));
     $reply->topic->generateLastReplyUserInfo();
     return redirect()->route('topics.show', $reply->topic_id);
 }
示例#3
0
 public function destroy($id)
 {
     //destroy reply
     $reply = \App\Reply::findOrFail($id);
     //权限
     $this->authorOrAdminPermissioinRequire($reply->user_id);
     $reply->article->decrement('reply_count', 1);
     //delete Vote
     $reply->votes()->delete();
     $reply->delete();
     return redirect('articles/' . $reply->article->photo);
 }