Please, how do I when editing a car, list all the brands, however already come selected the brand that has been registered previously.
VIEW -> http://laravel.io/bin/PXOX1 CONTROLLER -> http://laravel.io/bin/42Y29
May be this will help:
{!! Form::label('marca_id', 'Marca do Carro:') !!}
{!! Form::select('marca_id', $nome, $carro->marca_id, ['class'=>'form-control']) !!}
The thrid parameter of Form::select() is for the current value.
<option value="{{ $marca->id }}" @if($carro->marca_id==$marca->id) selected="selected" @endif>{{ $marca->marca }}</option>
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community