4 changed files with 43 additions and 32 deletions
-
29src/CrudMake.php
-
7src/Generators/BaseGenerator.php
-
8src/Generators/ControllerGenerator.php
-
31src/Generators/ModelGenerator.php
@ -0,0 +1,31 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Luthfi\CrudGenerator\Generators; |
||||
|
|
||||
|
/** |
||||
|
* Controller Generator Class |
||||
|
*/ |
||||
|
class ModelGenerator extends BaseGenerator |
||||
|
{ |
||||
|
/** |
||||
|
* {@inheritDoc} |
||||
|
*/ |
||||
|
public function generate() |
||||
|
{ |
||||
|
$modelPath = $this->modelNames['model_path']; |
||||
|
$modelDirectory = $this->makeDirectory(app_path($modelPath)); |
||||
|
|
||||
|
$this->generateFile($modelDirectory.'/'.$this->modelNames['model_name'].'.php', $this->getContent()); |
||||
|
|
||||
|
$this->command->info($this->modelNames['model_name'].' model generated.'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* {@inheritDoc} |
||||
|
*/ |
||||
|
protected function getContent() |
||||
|
{ |
||||
|
$stub = $this->files->get(__DIR__.'/../stubs/model.stub'); |
||||
|
return $this->replaceStubString($stub); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue