public function store_or_edit_shift($request, $shift_id = NULL) { $shift = $this->input->post('shift'); $description = $this->input->post('description'); $start_time = date("H:i", strtotime($this->input->post('start_time'))); $end_time = date("H:i", strtotime($this->input->post('end_time'))); $data = array('name' => $shift, 'description' => $description, 'start_time' => $start_time, 'end_time' => $end_time); if ($request == 'add') { return Shifts_model::insert_shift($data); } else { return Shifts_model::update_shift($shift_id, $data); } }