Ad
How Can I Use Rules Method With FormRequest In Laravel Js Validation?
This is my Request page: request
{!! \JsValidator::formRequest('App\Http\Requests\Backend\UserRequest', '#my-form') !!}
im trying like this with Laravel JS Validation. But i have some errors like this: errors
I'm using the form like this:
{!! Form::model($user, ['class' => 'form-horizontal form-bordered', 'route' => ['admin.user.update', $user->id], 'method' => 'PATCH', 'id' => 'my-form']) !!}
Ad
Answer
I solved it like this:
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',
];
Maybe it is solves other people's problems. Thanks for interesting my questions...
Ad
source: stackoverflow.com
Related Questions
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → DropzoneJS & Laravel - Output form validation errors
- → laravel check between 2 integer from database
- → How can I use rules method with formRequest in Laravel Js Validation?
- → Is it possible to turn off JavaScript for some tests using Codeception?
- → How to set required validation for inner field of repeater in OctoberCMS?
- → Model Validation in laravel 5.1 not working
- → Issues with jQuery Validate onkeyup and highlighting
- → Laravel validation required rule not working
- → Nested array validation laravel
- → How to change Laravel Validation message for max file size in MB instead of KB?
- → Backbone: Show validation errors for each model in a collection on VIEW
- → OctoberCMS plugin show all the validations at once
Ad