/** * Delete an Schdule * * @return Response */ public function delete($org_id = null, $cal_id = null, $id = null) { //check branch $schedule = \App\ThunderID\WorkforceManagementV1\Models\Calendar::id($cal_id)->organisationid($org_id)->first(); if (!$schedule) { \App::abort(404); } $schedule = \App\ThunderID\WorkforceManagementV1\Models\Schedule::calendarid($cal_id)->id($id)->first(); if (!$schedule) { return new JSend('error', (array) Input::all(), 'Schdule tidak ditemukan.'); } $result = $schedule->toArray(); if ($schedule->delete()) { return new JSend('success', (array) $result); } return new JSend('error', (array) $result, $schedule->getError()); }
/** * Delete a calendar * * @return Response */ public function delete($org_id = null, $id = null) { // $calendar = \App\ThunderID\WorkforceManagementV1\Models\Calendar::id($id)->organisationid($org_id)->with(['organisation'])->first(); if (!$calendar) { return new JSend('error', (array) Input::all(), 'Kantor Cabang tidak ditemukan.'); } $result = $calendar->toArray(); if ($calendar->delete()) { return new JSend('success', (array) $result); } return new JSend('error', (array) $result, $calendar->getError()); }