这是我的请求页面:request
{!! \JsValidator::formRequest('App\Http\Requests\Backend\UserRequest', '#my-form') !!}
我尝试使用Laravel JS验证。但我有一些错误:errors
我正在使用这样的表格:
{!! Form::model($user, ['class' => 'form-horizontal form-bordered', 'route' => ['admin.user.update', $user->id], 'method' => 'PATCH', 'id' => 'my-form']) !!}
答案 0 :(得分:1)
if (\Request::segment(3) == "create")
return [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.\Request::segment(3),
'password' => 'required|min:5|confirmed',
];
else
return [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.\Request::segment(3),
'password' => 'min:5|confirmed',
];
也许它解决了其他人的问题。感谢有趣的我的问题...