1
I’m having trouble making one Form:select
searching information from the database.
How is the Controller
;
public function create()
{
return View('internos.create');
}
How’s the View
;
<div class="form-group">
{{ Form::label('setor', 'Setor: ') }}
{{ Form::select('setor_id',
array(''=>'Selecione...')+ Setor::all()->lists('descricao', 'id'),
null, array('class'=>'form-control'))
}}
</div>
I executed this routine and gave the following error: public Function create() { $setors = Sector::all()->lists('Description', 'id'); $setors[''] = 'Select...'; Return View('internal.create', ['setors' => $setors]); } ;"Class 'App Http Controllers RH Sector' not found"
– Aguinaldo Tupy
@Aguinaldotupy you need to add the Sector! namespace to your controller
– novic
Friend, I still have a problem =/ "Method lists does not exist."
– Aguinaldo Tupy
I made a change in my question has to be like this
$setors = Setor::pluck('descricao', 'id')
@Aguinaldotupy– novic
Shoooow Eternally grateful for the help! The method Return View('internal.create', Compact('$setors')); will not... But it worked with the other method. !
– Aguinaldo Tupy
If it is useful to vote for it to answer your question, will yes it was written wrong I made a new edition @Aguinaldotupy
– novic