Ejemplo n.º 1
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $comment_id = $this->input('id');
     $comment = StatusComment::findOrFail($comment_id);
     $user = Auth::user();
     $is_owner = $comment->user_id == Auth::user()->id;
     if ($is_owner || $user->can('manage_comments')) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 public function commentSave(UpdateStatusComment $request)
 {
     $data = $request->all();
     $mention = new Mention();
     $comment = StatusComment::findOrFail($data['id']);
     $comment->body_original = $data['body'];
     $comment->body = markdown($mention->parse($data['body']));
     $comment->save();
     flash()->success('Komentaras sėkmingai atnaujintas!');
     return redirect()->route('status.show', $comment->status->id);
 }