Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 2 years ago.
0

Read up on Eloquent here. Eloquent follows certain naming conventions you should follow.

Also, read up on Eloquent relations. This way you can access related tables with some good old' "Magic".

To answer your question: user first() instead of get(). The get() function will retrieve a collection, while the first() method will retrieve a single record.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.

© 2024 Laravel.io - All rights reserved.