Laravel Advanced - Polymorphic Relationship
HTML-код
- Опубликовано: 2 окт 2024
- Let's be friends:
/ aashish_dhamala
Github Repo:
Please read the readme to access the code for the specific video.
github.com/lar...
Laravel 8 Advanced - Has One Relationship
• Laravel Advanced - Has...
Laravel 8 Advanced - Has Many Relationship
• Laravel Advanced - Has...
In this video, I have discussed the has many polymorphic relationship.
A polymorphic relationship allows the target model to belong to more than one type of model using a single association.
In a one to many polymorphic relationship, the target model can belong to more than one type of model on a single association. For example, imagine users of your application can "comment" on both posts and products. Using polymorphic relationships, you may use a single comments table for both of these scenarios.
We have a lot of benefits when using polymorphic relationship. However, we have one disadvantage that we will not be able to use the foreign key here.
That was exactly what I was looking for. So do I need to write the foreign keys manually?
Usefull
Nice video, thanks.
you are an awesome teacher
Great video! Well done.
Thanks
What about many to many?
I have video on all the relationship in laravel. You can check my channel
Wonderful Video
Thank you! Cheers!