コード例 #1
0
ファイル: Generator.php プロジェクト: czim/laravel-pxlcms
 /**
  * @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;
 }
コード例 #2
0
ファイル: ModelWriter.php プロジェクト: czim/aalberts-pxlcms
 /**
  * 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;
 }