Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Command/GenerateModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ protected function getOptions()
['no-timestamps', 'ts', InputOption::VALUE_NONE, 'Set timestamps property to false', null],
['date-format', 'df', InputOption::VALUE_OPTIONAL, 'dateFormat property', null],
['connection', 'cn', InputOption::VALUE_OPTIONAL, 'Connection property', null],
['backup', 'b', InputOption::VALUE_NONE, 'Backup existing model', null]
['backup', 'b', InputOption::VALUE_NONE, 'Backup existing model', null],
['abstract-class', 'a', InputOption::VALUE_NONE, 'Model as abstract class', null],
];
}
}
6 changes: 5 additions & 1 deletion src/Processor/TableNameProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ public function process(EloquentModel $model, Config $config)
$className = $config->get('class_name');
$baseClassName = $config->get('base_class_name');
$tableName = $config->get('table_name');
$abstract = $config->get('abstract_class');

$model->setName(new ClassNameModel($className, $this->helper->getShortClassName($baseClassName)));
$classNameModel = new ClassNameModel($className, $this->helper->getShortClassName($baseClassName));
$classNameModel->setAbstract($abstract);

$model->setName($classNameModel);
$model->addUses(new UseClassModel(ltrim($baseClassName, '\\')));
$model->setTableName($tableName ?: $this->helper->getDefaultTableName($className));

Expand Down
1 change: 1 addition & 0 deletions src/Resources/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
'date_format' => null,
'connection' => null,
'backup' => null,
'abstract_class' => null,
];