<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Publication Status</label>
<div class="col-sm-10">
<select name="publicationStatus" class="form-control">
<option value="">Select Manufacturer</option>
<option value="1">Published</option>
<option value="0">Unpublished</option>
</select>
<span class="text-danger">{{$errors->has('publicationStatus')? $errors->first('publicationStatus'):''}}</span>
</div>
</div>
我的控制器
public function storeManufacturer(Request $request){
$this->validate($request,[
'manufacturerName'=>'required',
'manufacturerDescription'=>'required',
'publicationStatus'=>'required',
]);
'manufacturerName'和'manufacturerDescription'上方有效,但 publicationStatus 的验证方式不同,可能是因为包含多个值。
答案 0 :(得分:0)
您可以先在控制器中使用dd()检查$ request的数据:
asFloat()