Support the ongoing development of Laravel.io →
Eloquent Blade Forms
Last updated 1 year ago.
0

Basic PHP I guess ?

$Aagents=array();
    foreach($agents as $agent)
    {
        $agents[$agent->index] = $agent->first_name." ".$agent->last_name;

    }
0

Thanks zaalbarxx

0
$agents = Agent::lists($value, $key);

// view
{{ Form::select('agent_id', $agents) }}
0

Not quite what pogachar said. If you already have a collection, just do the following:

{{ Form::select('agent_id', $agents->lists('id', 'first_name');

Or, if you need the full name - write a getter on the model that retrieves them both as name(), then you can use name as the last argument in the lists() call.

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.