5 months ago

Populate select element with data from multiple columns

Posted 5 months ago by mleontenko

I have the following select element in my form:

<div class="form-group">
    {{ Form::label('users', 'Users:') }}
    {{ Form::select('users[]', $users, null, ['id' => 'users', 'class' => 'form-control', 'multiple' => 'multiple']) }}

The data is passed to form view via controler like this:

$users = DB::table('users')->pluck('lastname', 'id');

This works fine, but in my users table, I also have "firstname" that I want to concatenate with lastname and fill the form. How can I do this?

Please sign in or create an account to participate in this conversation.