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

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

0

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.

0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

e4rthdog e4rthdog Joined 15 Apr 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2022 Laravel.io - All rights reserved.