dimanche 14 juin 2020

Laravel 5 Repository Validator Custom Rule

I am using l5-repository.

I could use validation rules here.

use \Prettus\Validator\LaravelValidator;

class PostValidator extends LaravelValidator {

    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'title' => 'required',
            'text'  => 'min:3',
            'author'=> 'required'
        ],
        ValidatorInterface::RULE_UPDATE => [
            'title' => 'required'
        ]
   ];

}

But what about other rule?

I hope to create RULE_SWITCH or other rules.

I think this uses laravel-validator package.

I would like to create custom RULE_SWITCH rule.

Thanks



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3d1LWzm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire