Skip to content

Conversation

arifmahmudrana
Copy link
Contributor

When running this php artisan make:migration:schema create_food_beneficials_table --schema="id:integer:unsigned, food_id:integer:unsigned, title:string, description:text:nullable" --model="Models/FoodNutrition/FoodBeneficial" it calls laravel make:model command but it creates model under app directory.

But when I run php artisan make:model Models/FoodNutrition/FoodBeneficial it creates correct model in correct directory inside app/Models/FoodNutrition.

I see in your https://github.com/laracasts/Laravel-5-Generators-Extended/blob/master/src/Commands/MigrationMakeCommand.php#L103 you are actually generating model name from meta table. Then what is the purpose for option model it's been only used as flag if the value of option model is true you are generating model. But it could have been used like laravel make:model command where you accept path not generate model name from meta table.

So my suggestion is you remove getModelName method(https://github.com/laracasts/Laravel-5-Generators-Extended/blob/master/src/Commands/MigrationMakeCommand.php#L219) & you rewrite this part(https://github.com/laracasts/Laravel-5-Generators-Extended/blob/master/src/Commands/MigrationMakeCommand.php#L101-L110) of code like this

When running this `php artisan make:migration:schema create_food_beneficials_table --schema="id:integer:unsigned, food_id:integer:unsigned, title:string, description:text:nullable" --model="Models/FoodNutrition/FoodBeneficial"` it calls laravel `make:model` command but it creates model under `app` directory.

But when I run `php artisan make:model Models/FoodNutrition/FoodBeneficial` it creates correct model in correct directory inside `app/Models/FoodNutrition`.

I see in your https://github.com/laracasts/Laravel-5-Generators-Extended/blob/master/src/Commands/MigrationMakeCommand.php#L103 you are actually generating model name from meta table. Then what is the purpose for option `model` it's been only used as flag if the value of option `model` is `true` you are generating model. But it could have been used like laravel `make:model` command where you accept path not generate model name from meta table.

So my suggestion is you remove `getModelName` method(https://github.com/laracasts/Laravel-5-Generators-Extended/blob/master/src/Commands/MigrationMakeCommand.php#L219) & you rewrite this part(https://github.com/laracasts/Laravel-5-Generators-Extended/blob/master/src/Commands/MigrationMakeCommand.php#L101-L110) of code like this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants