Answers for "email validation in laravel 7"

PHP
3

email validation in laravel

'email' => 'required|email|unique:users,email',
//@sujay
Posted by: Guest on October-09-2020
0

email validation in laravel

'user.email' => 'required|email|unique:users,email,'.$user->id,
//@sujay
Posted by: Guest on October-09-2020
2

rule::exists with custom message laravel

$messsages = array(
		'email.required'=>'You cant leave Email field empty',
		'name.required'=>'You cant leave name field empty',
                'name.min'=>'The field has to be :min chars long',
	);

	$rules = array(
		'email'=>'required|unique:content',
		'name'=>'required|min:3',
	);

	$validator = Validator::make(Input::all(), $rules,$messsages);
Posted by: Guest on May-07-2020
0

email validation in laravel

$validator = Validator::make($request->all(), []);

 $validator->sometimes('email', 'unique:users,email', function ($input) {
            return $input->email !== Auth::user()->email;
        });
//@sujay
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language