diff --git a/app/Console/Commands/ModelMakeCommand.php b/app/Console/Commands/ModelMakeCommand.php index 17cf4762ecfe27d68a516aaa9f81a07ce84042b3..b59ca88310f171463793e43b53ee31d0f731fbb6 100644 --- a/app/Console/Commands/ModelMakeCommand.php +++ b/app/Console/Commands/ModelMakeCommand.php @@ -21,6 +21,10 @@ protected function buildClass($name): string '{{classVariable}}' => $classVar, '{{ classVariable }}' => $classVar, ]; + + $serviceNamespace = $this->getNamespace($name); + $replace["use {$serviceNamespace}\Model;\n"] = ''; + return str_replace( array_keys($replace), array_values($replace), parent::buildClass($name) ); diff --git a/app/Console/Commands/stubs/model.stub b/app/Console/Commands/stubs/model.stub index 3bc73cd01e2297b95ff43a12a002e340ff9b18e3..7c6c90604647d54e2cd0c242b50656f030e22961 100644 --- a/app/Console/Commands/stubs/model.stub +++ b/app/Console/Commands/stubs/model.stub @@ -2,8 +2,8 @@ namespace {{ namespace }}; +use {{ rootNamespace }}Models\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; class {{ class }} extends Model { diff --git a/app/Models/Model.php b/app/Models/Model.php new file mode 100644 index 0000000000000000000000000000000000000000..754f8a5d6554208ff91b2a59029a41030482993e --- /dev/null +++ b/app/Models/Model.php @@ -0,0 +1,17 @@ +format('Y-m-d H:i:s'); + } +}