Created
July 1, 2018 11:37
-
-
Save jarektkaczyk/ab66eb30656defdbe0edcec8bef752aa to your computer and use it in GitHub Desktop.
multi step validation in laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function someController(Request $request) | |
{ | |
// asumming ValidatesRequests trait in use we'll call $this->validate | |
$this->validate($request, [ | |
// first set of rules | |
]); | |
if ($request->has('some_field')) { | |
$this->validate($request, [ | |
// conditional set of rules | |
]); | |
} | |
// good to go! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment