Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model file path not reflecting when make model #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

model file path not reflecting when make model #88

wants to merge 1 commit into from

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