Skip to content

Instantly share code, notes, and snippets.

@MarceauKa
Last active Mar 29, 2019
Embed
What would you like to do?
Laravel Blade Errors
<?php
Blade::directive('errormessage', function ($expression) {
return '<?php if ($errors->has(' . $expression . ')): echo \'<span class="help-block">\'.$errors->first(' . $expression . ').\'</span>\'; endif; ?>';
});
Blade::directive('errorexists', function ($expression) {
return '<?= $errors->has(' . $expression . ') ? " has-error" : ""; ?>';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment