Answers for "laravel validate 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
2

numbric validate laravel

$rules = ['Fno' => 'numeric|min:2|max:5', 'Lno' => 'numeric|min:2'];
Posted by: Guest on November-01-2020
1

laravel unique validation

/**
 * Store a new blog post.
 *
 * @param  Request  $request
 * @return Response
 */

public function store(Request $request)
{
    $validatedData = $request->validate([
        'title' => 'required|unique:posts|max:255',
        'body' => 'required',
    ]);

    // The blog post is valid...
}
Posted by: Guest on June-03-2020
4

laravel validation

/**
 * Store a new blog post.
 *
 * @param  Request  $request
 * @return Response
 */
public function store(Request $request)
{
    $validatedData = $request->validate([
        'title' => 'required|unique:posts|max:255',
        'body' => 'required',
    ]);

    // The blog post is valid...
}
Posted by: Guest on October-19-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

Browse Popular Code Answers by Language