Answers for "validation laravel regex"

PHP
3

enie letter validation laravel regex

return [
                    'fname' => 'required|max:255|regex:/^[a-zA-ZÑñ\s]+$/',
                    'lname' => 'required|max:255|regex:/^[a-zA-ZÑñ\s]+$/',
                    'mname' => 'max:255|alpha',
                     'file' => 'image|mimes:jpg,jpeg,png',
               'contact_no' => 'regex:/^[-0-9\+]+$/',
            'date_of_birth' => 'required|date_format:Y-m-d',
                'school_id' => 'required|exists:schools,id',
                'degree_id' => 'required|exists:degrees,id',
        ];
Posted by: Guest on October-29-2020
9

laravel validator make custom message

$rules = [
        'name' => 'required',
        'email' => 'required|email',
        'message' => 'required|max:250',
    ];

    $customMessages = [
        'required' => 'The :attribute field is required.'
    ];

    $this->validate($request, $rules, $customMessages);
Posted by: Guest on May-06-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

Code answers related to "validation laravel regex"

Browse Popular Code Answers by Language