dimanche 22 avril 2018

Laravel - Additional custom validation only when previous passed

I have validation like this:

    $validator = Validator::make($request->all(), [
        'parent_id' => 'bail|required|integer|exists:tree_nodes,id',
        'name'      => 'bail|required|max:255',
        'position'  => 'bail|nullable|numeric',
        'path'      => 'bail|nullable|max:255'
    ]);

But I need additional custom validation for "path" field based on "parent_id", "name" and "path" fields values and executed only when previous simple validation passed. How to do that?



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

Aucun commentaire:

Enregistrer un commentaire