-1
I have a method that invokes the view as follows:
return view('auth.register',[
'teachers' => $this->user->mentors()->lists('name','id'),
]);
And in the view, the select
using {{ Form::select() }}
occurs perfectly. The Master method returns the teachers in alphabetical order and takes only the name
and the id
with the list
, so far it is obvious.
But I’d like to add one option
at the beginning of collection
"Choose a teacher". I did so:
collect(['' => 'Escolha um professor'])->merge($this->user->mentors()->lists('name','id'));
But in doing so, the value of id
is replaced by index
, as if it were an array.
How can I fix this?