I'm trying to create a select with the following code:
My controller looks like this:
public function create(){
$marcas = Marca::lists('descricao', 'id')->toArray();
return view('sistema.modelos.create', ['marcas'=>$marcas]);
}
My view looks like this:
{!! Form::open(['route'=>'sistema.modelos.store']) !!}
{!! Form::select('marca_id', $marcas ) !!}
{!! Form::close() !!}
You are giving the following error:
Trying to get property of non-objec
Has anyone ever gone through this? Do you know how to do this?
editing ---
I've already done this:
$marcas = Marca::all(['id', 'descricao']);
return view('sistema.modelos.create', compact('marcas',$marcas));
According to the link: link
In this case the select up is rendered, but looks like this:
<select name="marca_id"><option value="0">{id : 1 , descricao : NOME}</option></select>