diff --git a/src/CrudMake.php b/src/CrudMake.php index a72439d..b1c5fd8 100644 --- a/src/CrudMake.php +++ b/src/CrudMake.php @@ -67,7 +67,7 @@ class CrudMake extends Command public function generateModel() { - $this->callSilent('make:model', ['name' => $this->modelName]);; + $this->files->put(app_path($this->modelName.'.php'), $this->getModelContent()); $this->info($this->modelName.' model generated.'); } @@ -160,6 +160,12 @@ class CrudMake extends Command return $this->replaceStubString($stub); } + public function getModelContent() + { + $stub = $this->files->get(__DIR__.'/stubs/model.stub'); + return $this->replaceStubString($stub); + } + private function getMigrationContent() { $stub = $this->files->get(__DIR__.'/stubs/migration-create.stub'); diff --git a/src/stubs/model.stub b/src/stubs/model.stub new file mode 100644 index 0000000..77c039e --- /dev/null +++ b/src/stubs/model.stub @@ -0,0 +1,10 @@ +assertEquals($modelClassContent, file_get_contents($modelPath));