krlove / eloquent-model-generator

Eloquent Model Generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: how to use with none laravel table/model naming conventions?

michabbb opened this issue · comments

hi,

i like my models to have the same name as the tables, so lets say we have these tables:

  • products
  • products_to_prices

when generating the model with products --table-name="products" ,
the model has a relation to "ProductToPrices" but not to "products_to_prices".
is there a chance to keep the original names of the tables inside the generated model
when it comes to docblocks and "hasmany/hasone..." relations ???

so in my case, i don´t want this inside my product model:

* @property productToPrices[] $productToPrices

instead i would like to see:

* @property product_to_prices[] $productToPrices

is there a chance to make this working ?

thanks!

Did you try generating the model for products_to_prices first ?

no, usually i create the model first that has less most dependencies. so when i have 10 tables referencing to an "article" table, i usually create "article" first, then all the referencing tables/models.

Atm there is no way to customise this naming, though this is not the first time people reporting such cases. I will consider this as potential improvement for the future, thanks.

P.S. Sorry for extremely late reply.