[Question] So this is simply helping me remove a couple lines of code by installing a package and running a command?
OzanKurt opened this issue · comments
So this is simply helping me remove a couple lines of code by installing a package and running a command?
In medium to large apps, like the one I'm working on now, it allows me to get rid of 100s of lines of redundant and repetitive code. And that's another thing less to worry about too as the morph map is something you need to maintain if your app structure changes. It also provides a uniform way of mapping the polymorphic types so there are no discrepancies.
You can just install the package and it automatically maps all your models. The cache command is optional but advised in production environments to speed it up a bit. Package itself is optional too ;)
Laravel auto morph map improves upon that by scanning all your Eloquent models, automatically aliasing them as uniform singular table names, and registering them as a polymorphic type. No more need for dozens of manual
Relation::morphMap()
calls to register model morph types!
Isn't the intro in the readme kind of the same? :p What would you add or change to make it more clear? Always love to hear feedback!