Relation table migration
Closed this issue · 1 comments
mjstealth commented
Describe the bug
If I define user_model that is, say, Customer model in config file, the table migration doesn't use the config file value to create the related table.
To Reproduce
Steps to reproduce the behavior:
- Go to 'promocodes.php
- Modify 'user_model' to use a different table. I use Customer instead of default User table.
- When you run 'php artisan migrate' after that, the promocode_user table still refers to Users table in the relationship (fk).
Expected behavior
Migration file should use the 'user_model' property from config("user_model").
This line(35) needs to be updated:
$table->foreign('user_id')->references('id')->on('user);
Versions (please complete the following information):
- Laravel: [e.g. 5.6]
- PHP [e.g. 7.2]
Additional context
Add any other context about the problem here.
zgabievi commented
You can now use vendor:publish
to publish migrations and refactor them locally.