Last active
June 25, 2019 14:25
-
-
Save thiagoeliasr/81edc3ea0063a4863e721282e223f734 to your computer and use it in GitHub Desktop.
Validate normal or JSON raw requests in Laravel FormRequest
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 | |
class ApiRequest extends FormRequest | |
{ | |
protected function validationData() | |
{ | |
return count($this->json()->all()) ? $this->json()->all() : $this->all(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment