/** * Display a listing of the resource. * * @return Response */ public function index() { try { $response = ['schedule' => []]; $statusCode = 200; $data = Performer::all(); //$users = User::all()->take(9); foreach ($data as $d) { $response['schedule'][] = ['id' => $d->id, 'events' => $d->events, 'start_time' => $d->start_time, 'end_time' => $d->start_time, 'location' => $d->end_time, 'festival_id' => $d->festival_id]; } } catch (Exception $e) { $statusCode = 404; } finally { return Response::json($response['schedule'], $statusCode); } }