old can be passed 'false' to ignore the redirect value

This commit is contained in:
Deon George 2024-08-17 13:14:51 +10:00
parent ba18a2a21c
commit be6061fb6e
10 changed files with 10 additions and 10 deletions

View File

@ -10,7 +10,7 @@
@endif
{{ $slot }}
<span class="invalid-feedback">
@error($old ?? $name)
@error((! empty($old)) ? $old : $name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}

View File

@ -1,5 +1,5 @@
<x-leenooks::form.base {{ $attributes }}>
<div class="form-check text-right">
<input type="checkbox" class="form-check-input {{ $class ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @checked(old($old ?? $name)) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="checkbox" class="form-check-input {{ $class ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @checked(old($old ?? $name)) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</div>
</x-leenooks::form.base>

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="date" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="date" class="form-control {{ $classes ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="email" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="email" class="form-control {{ $classes ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>

View File

@ -1,5 +1,5 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="file" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="file" class="form-control {{ $classes ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>
{{ $slot }}

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="password" class="form-control {{ $classes ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="password" class="form-control {{ $classes ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>

View File

@ -1,6 +1,6 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="hidden" id="{{ $name }}_disabled" name="{{ $name }}" value="" disabled>
<select class="form-control @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required)) @disabled(isset($disabled))>
<select class="form-control @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required)) @disabled(isset($disabled))>
@if(empty($value) || isset($addnew) || isset($choose))
<option value=""></option>
@isset($addnew)

View File

@ -1,3 +1,3 @@
<x-leenooks::form.base {{ $attributes }}>
<input type="text" class="form-control {{ $class ?? ''}}@error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" placeholder="{{ $placeholder ?? '' }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="text" class="form-control {{ $class ?? ''}}@error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" placeholder="{{ $placeholder ?? '' }}" value="{{ old($old ?? $name,$value ?? '') }}" @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
</x-leenooks::form.base>

View File

@ -10,7 +10,7 @@
</div>
@endif
<div class="w-100">
<textarea class="form-control {{ $classes ?? ''}} @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>{{ old($old ?? $name,$value ?? '') }}</textarea>
<textarea class="form-control {{ $classes ?? ''}} @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>{{ old($old ?? $name,$value ?? '') }}</textarea>
<span class="invalid-feedback">
@error($old ?? $name)
{{ $message }}

View File

@ -1,7 +1,7 @@
<div class="form-group">
<div class="input-group has-validation">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
<input type="checkbox" class="custom-control-input @error($old ?? $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @checked(old($old ?? $name,$value ?? '')) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
<input type="checkbox" class="custom-control-input @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @checked(old($old ?? $name,$value ?? '')) @readonly(isset($readonly)) @required(isset($required)) @disabled(isset($disabled))>
@if(isset($label))
<label class="custom-control-label" for="{{ $id ?? $name }}">{{ $label }}</label>
@endif