appstract / laravel-blade-directives

A collection of nice Laravel Blade directives
MIT License
858 stars 75 forks source link

New @error directive #43

Closed adriaroca closed 5 years ago

adriaroca commented 5 years ago

In many of my projects I tend to use @if ($ errors-> has ('input_name')) to detect if an input has an error. For a more comfortable reading, I suggest you add this directive:

Replace this:

@if($errors->has('input_name')) This input has an error @endif

For:

@error('input_name') This input has an error @enderror

gizburdt commented 5 years ago

Cool idea! :)

But we think ifHasError is a better name for the directive. Can you change it?

Thanks!

adriaroca commented 5 years ago

Done ;)

gizburdt commented 5 years ago

Sorry, we changed our minds, please rename it to hasError, and please change the enderror to endhaserror. Sorry for the redundant work, but thanks for the PR! :)

gizburdt commented 5 years ago

Thanks :)