0
I have the following select on a form in the Laravel:
<div class="form-group has-feedback {{ $errors->has('nivel') ? 'has-error' : '' }}">
<label for="nivel" class="col-sm-2 control-label">Nível de acesso</label>
<div class="col-sm-10">
<select class="form-control" name="nivel" value="{{ $detailpage->nivel }}" placeholder="Nivel de acesso">
@if($detailpage->nivel != 2) <option value="2">Operacional</option>
@else <option value="2" selected>Operacional</option>
@endif
@if($detailpage->nivel != 1) <option value="1">Administrativo</option>
@else <option value="1" selected>Administrativo</option>
@endif
</select>
</div>
</div>
This is an example, in practice there will be several categories.
Is there any way to put something like:
<option value="1" @if($detailpage->nivel != 1) selected >Administrativo</option>
That is to say that the item with the value == nivel
sera selected
and the others not
But in a simpler way than I used
Thanks, it worked
– Mateus
Corrected the != by ==
– jefissu