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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community