make request in laravel code example

Example 1: php artisan make:request

php artisan make:request User\CreateUserRequest

Example 2: create form request laravel

php artisan make:request StoreBlogPost

Example 3: 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);

Tags:

Php Example