Good morning! I followed what is said in this tutorial to fill values in a view: link
And I did the same scheme on my controller:
public function select_cursos_disciplinas()
{
$cursos = DB::table('select * from cursos');
$disciplinas = DB::table('select * from disciplinas');
return view('cadastros.disciplinas_curso', ['cursos' => $cursos, 'disciplinas' => $disciplinas]);
}
In my view it looks like this:
<select class="form-control">
<option disabled selected> --- </option>
@if ($cursos)
@foreach ($cursos as $curso)
<option> {{ $curso->nome }} </option>
@endforeach
@endif
</select>
However, it is giving the error "Trying to get property of non-object". I already researched but did not find the solution for what I need, because the solution was for only one value, but in my case I want several values even.
What should I do to make my select complete? Thanks