Support the ongoing development of →
Database Eloquent Laravel
Last updated 2 years ago.

As far as I'm aware find only returns one database row. What happens if you don't use pluck, what do you get? How do you know you are getting all registered names and ids? are you dding the result?

mazedlx liked this reply


use where() instead of find()

$department = Department::where('id',$office->department_id)->pluck('name', 'id');

mazedlx, marcio944 liked this reply

Solution selected by @marcio944

Sign in to participate in this thread!


Your banner here too?


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.

© 2024 - All rights reserved.