|
|
@ -86,7 +86,17 @@ class CrudMake extends Command |
|
|
{ |
|
|
{ |
|
|
$this->getModelName(); |
|
|
$this->getModelName(); |
|
|
|
|
|
|
|
|
if ( ! $this->modelExists()) { |
|
|
|
|
|
|
|
|
if ($this->modelExists()) { |
|
|
|
|
|
$this->error("{$this->modelNames['model_name']} model already exists."); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Warn if it has no default layout view based on
|
|
|
|
|
|
// simple-crud.default_layout_view config
|
|
|
|
|
|
if ($this->defaultLayoutNotExists()) { |
|
|
|
|
|
$this->warn(config('simple-crud.default_layout_view').' view does not exists.'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
app(WebRouteGenerator::class, ['command' => $this])->generate(); |
|
|
app(WebRouteGenerator::class, ['command' => $this])->generate(); |
|
|
app(ModelGenerator::class, ['command' => $this])->generate(); |
|
|
app(ModelGenerator::class, ['command' => $this])->generate(); |
|
|
app(MigrationGenerator::class, ['command' => $this])->generate(); |
|
|
app(MigrationGenerator::class, ['command' => $this])->generate(); |
|
|
@ -101,9 +111,6 @@ class CrudMake extends Command |
|
|
app(ModelPolicyTestGenerator::class, ['command' => $this])->generate(); |
|
|
app(ModelPolicyTestGenerator::class, ['command' => $this])->generate(); |
|
|
|
|
|
|
|
|
$this->info('CRUD files generated successfully!'); |
|
|
$this->info('CRUD files generated successfully!'); |
|
|
} else { |
|
|
|
|
|
$this->error("{$this->modelNames['model_name']} model already exists."); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -169,4 +176,16 @@ class CrudMake extends Command |
|
|
app_path($this->modelNames['model_path'].'/'.$this->modelNames['model_name'].'.php') |
|
|
app_path($this->modelNames['model_path'].'/'.$this->modelNames['model_name'].'.php') |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Check for default layout view file existance |
|
|
|
|
|
* |
|
|
|
|
|
* @return void |
|
|
|
|
|
*/ |
|
|
|
|
|
public function defaultLayoutNotExists() |
|
|
|
|
|
{ |
|
|
|
|
|
return ! $this->files->exists( |
|
|
|
|
|
resource_path('views/'.str_replace('.', '/', config('simple-crud.default_layout_view')).'.blade.php') |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
} |