/** * Display a listing of the resource. * * @return Response */ public function index() { $exercises = Exercise::all(); return view('exercises.index', compact('exercises')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return Response::json(Exercise::all()); }
public function all() { if (!Auth::check()) { // The user is logged in... return redirect('auth/login'); } $exercises = Exercise::all(); return response()->json(array('success' => true, 'data' => $exercises)); }