I am using Laravel and Validation class and i was wondering if is it possible to share data between rules. For example, if i do:
$validator = Validator::make($request->json()->all(), [
'account' => ['required', new IsAccount, 'bail', new IsActive],
]);
can i use in my custom rule IsActive a property defined by previous IsAccount? I think probably is possible because essentially validator is a class so i just have to set a property, but is it a good practice? and what is the best way to do it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire