当验证$validator 或者$this->validate 或者$request->session()->put('alert-danger', '错误的序列号!'); 当进入view视图的时候seesion里面是空的
<< 上一篇: Laravel5.4 升级5.5之后,错误页面不显示详细信息了
>> 下一篇: $request = Illuminate\Http\Request::capture()
图片上传不上去
Route::group(['middleware' => ['login','web']], function () {}
if($request->isMethod('post')){ $roles = [ 'channel_name' => 'required', 'channel_flag' => 'required', 'channel_server_ip' => 'required', 'channel_server_catalog' => 'required', ]; $msg = [ 'channel_name' => ':Attribute 不能为空', 'channel_flag' => ':Attribute 不能为空', 'channel_server_ip' => ':Attribute 不能为空', 'channel_server_catalog' => ':Attribute 不能为空', ]; $validator = Validator::make($request->all(),$roles); if($validator->fails()){ return redirect('maintain_service_add')->withErrors($validator->errors()); } dd(2); }
<?php
var_dump($errors); ?> @if (count($errors) > 0) <div class="alert alert-danger"> <ul> <li>{{ $error->all()}}</li> </ul> </div> @endif
2 Comments
图片上传不上去
Route::group(['middleware' => ['login','web']], function () {}
if($request->isMethod('post')){
$roles = [
'channel_name' => 'required',
'channel_flag' => 'required',
'channel_server_ip' => 'required',
'channel_server_catalog' => 'required',
];
$msg = [
'channel_name' => ':Attribute 不能为空',
'channel_flag' => ':Attribute 不能为空',
'channel_server_ip' => ':Attribute 不能为空',
'channel_server_catalog' => ':Attribute 不能为空',
];
$validator = Validator::make($request->all(),$roles);
if($validator->fails()){
return redirect('maintain_service_add')->withErrors($validator->errors());
}
dd(2);
}
<?php