I am trying to bring a select already selected according to the information that is stored in the database. But I'm having a lot of trouble. I'll leave the code below.
Controller
public function ListaUf()
{
$ListaUf = Estado::all();
return view(‘psicologo’,compact(‘ListaUf’));
}
Routes
Route::get(’/psicologo/editar/{psi_codigo}’,‘ControladorMunicipioUf@ListaUf’);
View
<select>
@foreach($ListaUf as $uf)
<option {{$psi->uf_codigo=={{$uf->uf_codigo}} ? 'selected':''}} value="{{$uf->uf_codigo}}">{{$uf->uf_estado}}</option>
@endforeach
</select>