Example #1
0
 public function run()
 {
     $duty_modle = new Duty();
     $com_id = $this->controller->comId;
     $hour_time = $_POST['start_time'] . '-' . $_POST['over_time'];
     //echo $hour_time;die;
     //$duty_modle->setAttributes($_POST);
     $duty_modle->day_time = $_POST['day_time'];
     $duty_modle->nurser_id = $_POST['nurser_id'];
     $duty_modle->hour_time = $hour_time;
     $duty_modle->com_id = $com_id;
     if ($duty_modle->save()) {
         $this->controller->redirect('/mama/duty/index/id/' + $duty_modle->nurser_id);
     }
 }
Example #2
0
 public function updateDuty(Duty $duty)
 {
     $inputs = ['monthPart' => Input::get('monthPart'), 'month' => Input::get('month'), 'year' => Input::get('year'), 'worker_id' => Input::get('worker_id')];
     $valid = Validator::make($inputs, Duty::$rules);
     if ($valid->passes()) {
         $duty->monthPart = $inputs['monthPart'];
         $duty->month = $inputs['month'];
         $duty->year = $inputs['year'];
         $duty->worker_id = $inputs['worker_id'];
         $duty->save();
         return Redirect::route('duty.list_fill')->with('success', 'Duty is saved!');
     } else {
         return Redirect::back()->withErrors($valid)->withInput();
     }
 }