From 18cb99215b8e1e290ab1f84747dd4f0ec5c904c1 Mon Sep 17 00:00:00 2001 From: Mohammad Hafijul Islam Date: Sat, 21 Mar 2026 23:03:20 +0600 Subject: [PATCH] inline style issue fixed --- resources/views/bootstrap4/regular/checkbox.blade.php | 5 +++-- resources/views/bootstrap4/regular/radio.blade.php | 4 +++- src/FormBuilder.php | 1 + src/Traits/ComponentTrait.php | 10 +++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/views/bootstrap4/regular/checkbox.blade.php b/resources/views/bootstrap4/regular/checkbox.blade.php index 7824ee5..3a117d0 100644 --- a/resources/views/bootstrap4/regular/checkbox.blade.php +++ b/resources/views/bootstrap4/regular/checkbox.blade.php @@ -1,6 +1,7 @@
- - {!! \Laraflow\Form\Facades\Form::label($name, $label, $required) !!} + @if(!empty($label)) + {!! \Laraflow\Form\Facades\Form::label($name, $label, $required, ['class' => $inline ? ['custom-control-inline'] : []]) !!} + @endif {!! \Laraflow\Form\Facades\Form::hint($attributes) !!} @php $attributes['class'][] = 'custom-control-input' @endphp diff --git a/resources/views/bootstrap4/regular/radio.blade.php b/resources/views/bootstrap4/regular/radio.blade.php index 76f1ab5..7921fec 100644 --- a/resources/views/bootstrap4/regular/radio.blade.php +++ b/resources/views/bootstrap4/regular/radio.blade.php @@ -1,5 +1,7 @@
- {!! \Laraflow\Form\Facades\Form::label($name, $label, $required, ['inline' => $inline]) !!} + @if(!empty($label)) + {!! \Laraflow\Form\Facades\Form::label($name, $label, $required, ['class' => $inline ? ['custom-control-inline'] : []]) !!} + @endif {!! \Laraflow\Form\Facades\Form::hint($attributes) !!} @php $attributes['class'][] = 'custom-control-input' @endphp diff --git a/src/FormBuilder.php b/src/FormBuilder.php index bb1f345..0ed0447 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -691,6 +691,7 @@ public function label(string $name, $title = null, bool $required = false, array } else { $options['class'] = ['sr-only']; } + unset($options['inline']); } $options = $this->attributes($options); diff --git a/src/Traits/ComponentTrait.php b/src/Traits/ComponentTrait.php index 413b069..b56335d 100644 --- a/src/Traits/ComponentTrait.php +++ b/src/Traits/ComponentTrait.php @@ -81,11 +81,6 @@ protected function getComponentData(array $signature, array $arguments) $i = 0; - if (isset($arguments['attributes']['inline'])) { - $data['inline'] = $arguments['attributes']['inline']; - unset($arguments['attributes']['inline']); - } - foreach ($signature as $variable => $default) { // If the "variable" value is actually a numeric key, we can assume that // no default had been specified for the component argument and we'll @@ -97,6 +92,11 @@ protected function getComponentData(array $signature, array $arguments) $data[$variable] = Arr::get($arguments, $i, $default); + if (isset($data['attributes']['inline'])) { + $data['inline'] = $data['attributes']['inline']; + unset($data['attributes']['inline']); + } + $i++; }