musaddiq-ciklum / laravel-learning

0 stars 1 forks source link

PIVOT table model is not needed #24

Open njaciklum opened 3 years ago

njaciklum commented 3 years ago

In Laravel although we can create model for pivot table but Laravel doesn't count it in best practices.

I can see you have a model for pivot table 'ProductSize', eliminate it and use Product and Size to achieve the same results.

For reference please take a look at https://laravel.com/docs/8.x/eloquent-relationships#filtering-queries-via-intermediate-table-columns