Created
September 20, 2018 03:22
-
-
Save lomotech/fe619ab13f8d61087c0c42fab69b7c03 to your computer and use it in GitHub Desktop.
laravel custom validation
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
public function boot() | |
{ | |
Validator::extend('both_not_filled', function ($attribute, $value, $parameters) { | |
$other = $parameters[0]; | |
if (!empty($value) && !empty($other)) { | |
return false; | |
} | |
return true; | |
}); | |
} |
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
'foo' => 'both_not_filled:',$request->get('bar') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment