Created
July 1, 2016 18:52
-
-
Save vinicius73/5d2c902f2832c4b69c8733561e5b889e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$blade = Blade::getFacadeRoot(); | |
$blade->directive('hasErrorClass', function ($expression) { | |
return '<?php echo ($errors->has' . $expression . ') ? "has-error" : null; ?>'; | |
}); | |
$blade->directive('errorBlock', function ($expression) { | |
$name = str_replace(['(', ')'], null, $expression); | |
return '<?php echo $errors->first(' . $name . ', \'<span class="help-block">:message</span>\') ?>'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment