Example #1
0
 /**
  * @return bool
  */
 public function generate()
 {
     // run analyzer pipeline
     $data = $this->analyzer->process(new AnalyzerData());
     if (!$this->write) {
         $this->debugOutput($data->output);
         return true;
     }
     // write models
     $this->modelWriter->setData($data->output);
     $this->modelWriter->writeFiles();
     // write repositories, if allowed to
     if (!config('pxlcms.generator.repositories.skip')) {
         $this->repositoryWriter->setData($data->output);
         $this->repositoryWriter->writeFiles();
     }
     return true;
 }
Example #2
0
 /**
  * Make model data array for translation model
  *
  * @param array $model
  * @return array
  */
 protected function makeTranslatedDataFromModelData(array $model)
 {
     $array = parent::makeTranslatedDataFromModelData($model);
     $array['prefix'] = $model['prefix'];
     // make sure translated casts are dealt with fully
     $array['casts'] = array_get($model, 'casts_translated', []);
     foreach (array_keys($array['casts']) as $column) {
         $array['normal_attributes'] = array_merge($array['normal_attributes'], [$column]);
         $array['normal_fillable'] = array_merge($array['normal_fillable'], [$column]);
         if (in_array($column, $model['dates'])) {
             $array['dates'] = array_merge($array['dates'], $column);
         }
     }
     return $array;
 }