Laravel: BelongsTo vs Polymorphic? Let’s Test!

I get a lot of questions about database structure, and in this video I will practically test two different DB structures and we will try to see which is better: belongsTo with three columns, or polymorphic relations? [00:50] Which DB…

Laravel: BelongsTo vs Polymorphic? Let's Test!

Source

I get a lot of questions about database structure, and in this video I will practically test two different DB structures and we will try to see which is better: belongsTo with three columns, or polymorphic relations?

[00:50] Which DB structure to choose?
[02:51] Which DB table is bigger in size?
[03:44] List of entries: which is faster?
[05:45] Querying by ID: which is faster or more convenient?
[08:00] Querying by name of the relationship
[10:24] Adding another field: where Polymorphic “shines”
[12:06] Polymorphic is not actually a relationship

– – – – –
Try our Laravel QuickAdminPanel: https://bit.ly/quickadminpanel
Enroll in my Laravel courses: https://laraveldaily.teachable.com