Skip to content

Instantly share code, notes, and snippets.

@martinbean martinbean/test.php
Created Feb 6, 2018

Embed
What would you like to do?
Throw a validation exception with a plain array of errors
<?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
You can’t perform that action at this time.