mardi 21 août 2018

Showing multiple variable in laravel select box

I am new to laravel. I want to create a select box in laravel form in which I want to show first name and last name in options. my controller is :

 $clients = Client::pluck('first_name','id')->toArray();
 $clients2 = Client::pluck('last_name','id')->toArray();
 view()->share('clients', $clients);
 view()->share('clients2', $clients2);

Here is my view file

 {!! Form::select('client_id', [''=>'--Select Client--']+$clients+ $clients2, null, ['id'=>'client_id', 'class' => 'form-control select2']) !!}

When I am executing this code then it is showing only first_name. How can I show the last_name also ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire