我只想询问如何将此转换为像{!!形成一些东西!}}。
第一个选择选项适用于具有男性和女性选项的性别。
虽然第二个选择选项具有Company表的选项,但我不想显示公司的第一个id。
你能帮我把它转换成laravel格式的选择吗?
<div class="col-md-2">
<div class="form-group-sm">
<select class="form-control form-control-sm" id="gender" name="gender">
<option selected disabled><small>Gender</small></option>
<option>All</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div>
<div class="col-md-2">
<div class="col-md-2">
<div class="form-group-sm">
<select class="form-control form-control-sm" id="company" name="company">
<option selected disabled>Company</option>
@foreach ($companies as $company)
@if (($company->id)=="1")
<option>All</option>
@else
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endif
@endforeach
</select>
</div>
</div>
</div>
答案 0 :(得分:1)
您应该使用此包laravelcollective / html转换您的表单和HTML。 https://laravelcollective.com/docs/5.4/html
答案 1 :(得分:0)
试试这个:
<select class="form-control form-control-sm" id="company" name="company">
<option selected disabled>Company</option>
@foreach ($companies as $company)
@if ($company->id!=1)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endif
@endforeach
</select>