I am using Laravel 5.5
and trying to fill a input select
with Eloquent and using the following code:
No controller
:
$tipos = Tipo::pluck('nome', 'id');
return view('teste')->with('tipos', $tipos);
In view
:
{{Form::select('tipo_id',
$tipos,
$imovel->tipo_id,
['id'=>'myselect','class' =>'form-control'])}}
In this way, each item of checkbox
turns an object as follows:
{"id":1,"nome":"casa","created_at":"2017-12-29 18:09:45","updated_at":"2017-12-29 18:09:45"}
How do I get only the nome
attribute in the item and id
in value ?