Support the ongoing development of →
Database Eloquent
Last updated 7 months ago.

Indexes speeds up search's, fk I would set up, you don't necessarily have to use.


You don't have to do anything with foreign keys to use Eloquent. Any relations defined in your application (hasOne, hasMany, etc.) don't rely on the foreign keys set up in the actual database. Indexes on foreign keys won't matter either for performance unless you're doing joins (which isn't how Eloquent retrieves the relationships anyways).

Foreign keys are really just an added layer of protection for database integrity.


Sign in to participate in this thread!


Your banner here too?

e4rthdog e4rthdog Joined 15 Apr 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.