示例#1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $fields = $this->fieldList;
     if ($this->id) {
         $fields = $this->fieldsFromModel($this->id, $fields);
     } else {
         $when = Carbon::now()->addHour();
         $fields['publish_date'] = $when->format('M-j-Y');
         $fields['publish_time'] = $when->format('g:i A');
     }
     foreach ($fields as $fieldName => $fieldValue) {
         $fields[$fieldName] = old($fieldName, $fieldValue);
     }
     return array_merge($fields, ['allTags' => Tag::lists('tag')->all()]);
 }