Skip to content

Commit

Permalink
Merge pull request #25 from Laravel-Lang/1.x
Browse files Browse the repository at this point in the history
Removed call to create parent model
  • Loading branch information
andrey-helldar authored Jun 23, 2024
2 parents 480cac1 + f1a2aa0 commit 6ca3531
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/Console/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace LaravelLang\Models\Console;

use Illuminate\Console\Command;
use Illuminate\Foundation\Console\ModelMakeCommand as BaseMakeCommand;
use Illuminate\Support\Str;
use LaravelLang\Models\Generators\MigrationGenerator;
use LaravelLang\Models\Generators\ModelGenerator;
Expand Down Expand Up @@ -63,9 +62,7 @@ protected function model(): ?string

$model = $this->resolveModelClass($name);

$this->createBaseModel($model);

return $model;
return class_exists($model) ? $model : null;
}

protected function columns(): array
Expand Down Expand Up @@ -123,16 +120,4 @@ protected function resolveModelClass(string $model): string

return '\App\Models' . $model;
}

protected function createBaseModel(string $model): void
{
if (! class_exists($model)) {
$this->call(BaseMakeCommand::class, [
'name' => Str::after($model, 'App\\Models\\'),
'--migration' => true,
'--factory' => true,
'--seed' => true,
]);
}
}
}

0 comments on commit 6ca3531

Please sign in to comment.