/** * 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); } }
<?php require_once __DIR__ . "/../bourbon/performer.php"; require_once __DIR__ . "/../bourbon/bandmate.php"; $p = new Performer(); $p->init(WEB::_get('id')); $b = new Bandmate(); $bandList = $b->getListOfBandWithPerformerId($p->getPerformerId()); ?> <?php if (!$p->valid()) { ?> <!-- // Invalid Record --> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Invalid Performer</h4> </div> <div class="modal-body"> <p>It looks like you were trying to access a performer that we no longer have.</p> </div> <?php } else { ?> <!-- // Valid Record --> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title"><strong><?php echo $p->getPerformerName(); ?>
<?php require __DIR__ . "/../bourbon/performer.php"; require __DIR__ . "/../bourbon/band.php"; require __DIR__ . "/../bourbon/bandmate.php"; $status_message = ''; // Status messages, default to nothing $form_error = null; $p = new Performer(); $p->auth(null); $b = new Bandmate(); $bandmateList = $b->getBandmateAsSelectWithPerformerId($p->getPerformerId()); $bd = new Band(); $bandList = $bd->getBandAsSelect(); // Handle Post Request if (WEB::_req('POST')) { $msg = WEB::_imageUpload($_FILES['image']); if (!array_key_exists('error', $msg)) { // $performer_name, $performer_date_of_birth, $performer_bio, $performer_cover $performer_name = WEB::_post('performer_name'); $performer_date_of_birth = WEB::_post('performer_date_of_birth'); $performer_bio = WEB::_post('performer_bio'); $performer_cover = $msg['file_path']; // Passed as: array($performer_name, performer_date_of_birth, performer_bio, performer_cover) $form_error = $p->validateParams(array($performer_name, $performer_date_of_birth, $performer_bio, $performer_cover)); if (is_null($form_error) && !is_null($performer_name) && !is_null($performer_date_of_birth) && $p->createPerformer($performer_name, $performer_date_of_birth, $performer_bio, $performer_cover)) { $status_message = WEB::_success('Performer Successfully Created!'); } else { $status_message = WEB::_error('There is an error when you were creating the Performer. Please review the form below!', $form_error); } // Handle adding multiple Bands
<?php require __DIR__ . "/../bourbon/band.php"; require __DIR__ . "/../bourbon/bandmate.php"; require __DIR__ . "/../bourbon/performer.php"; require __DIR__ . "/../bourbon/label.php"; $status_message = ''; // Status messages, default to nothing $form_error = null; $bd = new Band(); $bd->auth(null); $b = new Bandmate(); $bandmateList = $b->getBandmateAsSelectWithBandId(null); $p = new Performer(); $performerList = $p->getPerformerAsSelect(); // Populate Genre Select List $l = new Label(); $labelList = $l->getLabelAsSelect(); // Handle Post Request if (WEB::_req('POST')) { $msg = WEB::_imageUpload($_FILES['image']); if (!array_key_exists('error', $msg)) { $band_name = WEB::_post('band_name'); $band_formed_date = WEB::_post('band_formed_date'); $band_break_up_date = WEB::_post('band_break_up_date'); $band_cover = $msg['file_path']; $band_bio = WEB::_post('band_bio'); $label_id = WEB::_post('label_id'); // array($band_name, $band_formed_date, $band_break_up_date, $band_cover, $band_bio) $form_error = $bd->validateParams(array($band_name, $band_formed_date, $band_break_up_date, $band_cover, $band_bio, $label_id)); if (is_null($form_error) && !is_null($band_name) && !is_null($band_formed_date) && $bd->createBand($band_name, $band_formed_date, $band_break_up_date, $band_cover, $band_bio, $label_id)) {
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Performer::find($id)->Festival()->detach(); Performer::find($id)->Association()->detach(); $person = Person::find($id); $a = Person::where('id', $id)->delete(); $response = []; $response["name"] = $person->name; if ($a > trashed()) { $statusCode = 200; $response['result'] = "deleted"; } else { $statusCode = 422; $response['result'] = "Cannot delete."; } return Response::json($response, $statusCode); }
<?php require __DIR__ . "/../bourbon/performer.php"; require __DIR__ . "/../bourbon/band.php"; require __DIR__ . "/../bourbon/bandmate.php"; $status_message = ''; // Status messages, default to nothing $form_error = null; $p = new Performer(); $p->auth(null); $p->init(WEB::_get('id')); $b = new Bandmate(); $bandmateList = $b->getBandmateAsSelectWithPerformerId($p->getPerformerId()); $bd = new Band(); $bandList = $bd->getBandAsSelect(); if (!$p->valid()) { $status_message = WEB::_error('Performer couldn\'t be viewed. Check ID #!', null); } // Handle Post Request if (WEB::_req('POST')) { $msg = WEB::_imageUpload($_FILES['image']); if (!array_key_exists('error', $msg)) { $performer_name = WEB::_post('performer_name'); $performer_date_of_birth = WEB::_post('performer_date_of_birth'); $performer_bio = WEB::_post('performer_bio'); $performer_cover = $msg['file_path']; // Passed as: array($performer_name, performer_date_of_birth, performer_bio, performer_cover) $form_error = $p->validateParams(array($performer_name, $performer_date_of_birth, $performer_bio, $performer_cover)); $updateStatus = true; if (is_null($form_error)) { if (!is_null($performer_name)) {
<?php require __DIR__ . "/bourbon/performer.php"; $status_message = ''; // Status messages, default to nothing // List View $p = new Performer(); // Handle Pagination of Performers $numOfPerformers = $p->performerCount(); $page = WEB::_get('pg'); if ($page === null) { $page = 0; } // Get Performer Data List (Used to display data in the table - see below) $performerList = $p->getPerformerAsList($page); // Handle Deleteing from this view... if (WEB::_action('delete')) { if ($p->deletePerformerById(WEB::_get('delete'))) { $status_message = WEB::_success('Performer was deleted successfully!'); $performerList = $p->getPerformerAsList($page); } else { $status_message = WEB::_error('Performer couldn\'t be deleted!', null); } } ?> <!-- // Begin Genre Template (List View) --> <?php include __DIR__ . "/bourbon/template/header.php"; ?>