Exemplo n.º 1
0
 public function postComment(Request $request)
 {
     $this->validate($request, ['comment' => 'required']);
     $comment = new TrackComment();
     $comment->track_id = $request->track_id;
     $comment->user_id = Auth::user()->id;
     $comment->comment = $request->comment;
     $comment->save();
     return redirect('track/view/' . $request->track_id);
 }
Exemplo n.º 2
0
 public function postDeleteTrackComment(Request $request)
 {
     if (!$request->ajax()) {
         return response('Bad request', 400);
     }
     $comment = App\TrackComment::findOrFail($request->id);
     $comment->delete();
     return response()->json(['status' => true]);
 }