Exemple #1
0
 public function saveWorkspace($date_begin, $facility_id, $date_end = false)
 {
     // 		\DB::enableQueryLog();
     $columns = ['USER_ID' => $this->ID];
     $newData = ['USER_ID' => $this->ID, 'USER_NAME' => $this->username];
     if ($date_begin) {
         $date_begin = \Helper::parseDate($date_begin);
         $newData['W_DATE_BEGIN'] = $date_begin;
     }
     if ($facility_id) {
         $newData['W_FACILITY_ID'] = $facility_id;
     }
     if ($date_end) {
         $date_end = \Helper::parseDate($date_end);
         $newData['W_DATE_END'] = $date_end;
     }
     return UserWorkspace::updateOrCreate($columns, $newData);
 }
 public function PdContract($option = null)
 {
     if ($option != null && is_array($option)) {
         if (array_key_exists('date_begin', $option)) {
             $beginBundle = $option['date_begin'];
             $date_begin = $beginBundle['id'];
         } else {
             $date_begin = $this->date_begin;
         }
         $date_begin = \Helper::parseDate($date_begin);
         if (array_key_exists('date_end', $option)) {
             $endBundle = $option['date_end'];
             $date_end = $endBundle['id'];
         } else {
             $date_end = $this->date_end;
         }
         $date_end = \Helper::parseDate($date_end);
         $sourceData = ['date_begin' => $date_begin, 'date_end' => $date_end];
         return PdContract::getByDateRange($sourceData);
     }
     return null;
 }