示例#1
0
 function postCapnhat($id)
 {
     // Get data
     $input['id'] = $id;
     $input['name'] = Input::get('name');
     $input['start_time'] = Input::get('start_time');
     $input['end_time'] = Input::get('end_time');
     // Validate
     $rules = ['id' => 'required|numeric|exists:shifts,id', 'name' => 'required|string|min:2|max:16', 'start_time' => 'required|date_format:H:i:s', 'end_time' => 'required|date_format:H:i:s'];
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         $errors_validate = $validator->messages()->all();
         return back()->with('errors_validate', $errors_validate)->withInput();
     }
     // If validate Ok
     $the_shift = Shift::find($input['id'])->update($input);
     add_message('Cập nhật thành công');
     return back();
 }
示例#2
0
 public static function processAtShift($shiftCode)
 {
     $findShift = Md\Shift::find($shiftCode);
     $timeSend = (new \DateTime($findShift->shift_to))->modify("+1 hours")->format('H:i');
     return $timeSend;
 }