laravel-shift / blueprint

A code generation tool for Laravel developers.
MIT License
2.86k stars 273 forks source link

Renaming relationship for belongsToMany #690

Closed Grolicek closed 4 months ago

Grolicek commented 4 months ago

Synopsis:

It would be great if there would be a way to rename relationship, like it is possible to do with other relations...

Proposed Syntax:

Since the Model:relation_name is already used for table name I don't have any suggestions...

Expected Behavior:

image The name of the function for relation could be different from the name of the Model, so it would be possible to have multiple relationships between same two models with different stuff stored in them. Such as Teacher and Student relationship between Person and Course

jasonmccreary commented 4 months ago

Blueprint is all about conventions. So, probably not something I would add. Especially since this is very easy to change after code generation.

With that said, I do think there might be a way to do this already. Maybe for simple relationships anyway. Again, not sure.

Grolicek commented 4 months ago

Okay thanks for your time.