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

Well, you can use something like this(not sure if it will work on the results of query as I dont know if it returns instance of Illuminate\Support\Collection but you can always create a one from array)

$agents = $agents->keyBy('id')->filter(function($item){
    return $item->first_name.' '.$item->last_name
});

This way you'll get the key => value list to use in select or dropdown or something else.

Or you can use ->toArray() method on the collection to also cast it to array. Not sure what is your purpose though.

Last updated 9 years ago.
0

Thanks zaalbarxx for replay but not work

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.