Example #1
0
 public function destroy($id)
 {
     $hour = Hour::with('schedules')->find($id);
     if ($hour->schedules->count() > 0) {
         Session::flash('message', 'Tidak dapat menghapus jam belajar! Jam belajar ini digunakan dalam jadwal belajar');
     } else {
         Hour::destroy($id);
         Session::flash('message', 'Sukses menghapus jam belajar!');
     }
 }
 function destroy($params)
 {
     if (!$params['id']) {
         bail('Required $params["id"] not present.');
     }
     $h = new Hour($params['id']);
     $support_contract_id = $h->get('support_contract_id');
     $h->destroy();
     isset($params['redirect']) ? $redirect = $params['redirect'] : ($redirect = array('controller' => 'SupportContract', 'action' => 'show', 'id' => $support_contract_id));
     $this->redirectTo($redirect);
 }
Example #3
0
 function destroy($params)
 {
     if (empty($params['id'])) {
         bail('Required parameter "id" is missing.');
     }
     $hour = new Hour($params['id']);
     $project_id = $hour->getProject()->id;
     $hour->destroy();
     $this->redirectTo(array('controller' => 'Project', 'action' => 'show', 'id' => $project_id));
 }