Пример #1
0
 /**
  * Delete a workout.
  *
  * @param $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function delete($id)
 {
     $this->workout->where(['id' => $id])->delete();
     return response(null, 204);
 }
Пример #2
0
 /**
  * Responds to GET::/workouts/delete/{id} requests
  *
  * @return redirect to /workouts
  */
 public function destroy($id)
 {
     $workout = Workout::find($id);
     if ($workout && $workout->user_id == \Auth::id()) {
         $workout->delete();
     } else {
         \Session::flash("message", "The workout could not be deleted.");
     }
     return redirect('/workouts');
 }