lundi 24 décembre 2018

Laravel custom validation rule. How to add possibility for passing rule with a string representation instead of using class name?

What do I mean:

As it's shown at documentation:

...
'field' => [
 'required',
 'numeric',
 new MyCustomRule
],
...

But what if I want to pass it in one string and with some arguments||options signature (as it's implemented with default "exists" rule where i can optionally pass connection, table, field, column and so on)?

...
'field' => 'required|numeric|my_rule:param1.param2,option1,option2',
...

Where should i define signature? Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2SjykGj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire