Created
October 22, 2018 18:58
-
-
Save nasrulhazim/c68a2b63264e81694b86f9d7499e41d3 to your computer and use it in GitHub Desktop.
Laravel Blade: Input Component
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
<div class="form-group row"> | |
<label for="{{ snake_case($label) }}" | |
class="{{ $label_class ?? 'col col-form-label' }}"> | |
{{ __($label) }} | |
</label> | |
<div class="{{ $input_container_class ?? 'col' }}"> | |
<input | |
@isset($readonly) | |
readonly="true" | |
@endisset | |
type="{{ $type ?? 'text' }}" | |
placeholder="@isset($placeholder) {{ __($placeholder) }} @else {{ __($label) }} @endisset" | |
class="form-control{{ $errors->has(snake_case($label)) ? ' is-invalid' : '' }} {{ $input_classes ?? '' }}" | |
@isset($id) | |
id="{{ $id }}" | |
@else | |
id="{{ snake_case($label) }}" | |
@endisset | |
@isset($name) | |
name="{{ $name }}" | |
@else | |
name="{{ snake_case($label) }}" | |
@endisset | |
@isset($onkeyup) | |
onkeyup="{{$onkeyup}}" | |
@endisset | |
@isset($step) | |
step="{{$step}}" | |
@endisset | |
@isset($value) | |
value="{{$value}}" | |
@endisset | |
@isset($readonly) | |
readonly="{{$readonly}}" | |
@endisset | |
value="{{ old(snake_case($label)) }}" | |
@isset($required) required @endisset autofocus> | |
@if ($errors->has(snake_case($label))) | |
<span class="invalid-feedback"> | |
<strong>{{ $errors->first(snake_case($label)) }}</strong> | |
</span> | |
@endif | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment