Answers for "laravel 8 api validation"

PHP
7

laravel validation example

//import		
		use Illuminate\Support\Facades\Validator;
	
		// single var check
        $validator = Validator::make(['data' => $value],
            ['data' => 'string|min:1|max:10']
        );
        if ($validator->fails()) {
            // your code
        }

        // array check
        $validator = Validator::make(['data' => $array],
            ['email' => 'string|min:1|max:10'],
            ['username' => 'string|min:1|max:10'],
            ['password' => 'string|min:1|max:10'],
            ['...' => '...']
        );

        if ($validator->fails()) {
            // your code
        }
Posted by: Guest on April-17-2020
0

laravel 8 api validation

php artisan make:request StorePostRequest
Posted by: Guest on June-08-2021
0

laravel validation

Validator::extendImplicit('foo', function ($attribute, $value, $parameters, $validator) {
    return $value == 'foo';
});
Posted by: Guest on December-25-2020

Browse Popular Code Answers by Language