Video by Laracasts on YouTube · 8 min. We did not make this video and we do not host it — watching it here still counts as a view for the creator.
Watch how to define hasMany and belongsTo relationships for User‑Post and Post‑Comment. Beginners often forget to add the foreign key column or mismatch naming conventions, causing empty relation results.
In a real blog API, eager loading (with) prevents N+1 query problems and improves performance dramatically.
Sign in with WhatsApp, your phone number, email or Google. No password. The same account carries your progress, your certificates and anything else you do with Nexgino later.
Sign in to continueIt takes about fifteen seconds.