Created
February 6, 2018 18:34
-
-
Save martinbean/ffcde746e70a0ad21446a1f47f743fd8 to your computer and use it in GitHub Desktop.
Throw a validation exception with a plain array of errors
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 | |
use Illuminate\Validation\ValidationException; | |
if ($coupon->cannotBeRedeemed()) { | |
throw ValidationException::withMessages([ | |
'coupon' => [ | |
'The coupon code is invalid.', | |
], | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment