diff --git a/app/View/Components/Forms/Input.php b/app/View/Components/Forms/Input.php index 5ed347f42..608684a8d 100644 --- a/app/View/Components/Forms/Input.php +++ b/app/View/Components/Forms/Input.php @@ -34,12 +34,13 @@ class Input extends Component public ?string $canGate = null, public mixed $canResource = null, public bool $autoDisable = true, + public ?string $suffix = null, ) { // Handle authorization-based disabling if ($this->canGate && $this->canResource && $this->autoDisable) { $hasPermission = Gate::allows($this->canGate, $this->canResource); - if (! $hasPermission) { + if (!$hasPermission) { $this->disabled = true; } } @@ -60,7 +61,7 @@ class Input extends Component if ($this->modelBinding && $this->modelBinding !== 'null') { // Use original ID with random suffix for uniqueness $uniqueSuffix = new Cuid2; - $this->htmlId = $this->modelBinding.'-'.$uniqueSuffix; + $this->htmlId = $this->modelBinding . '-' . $uniqueSuffix; } else { $this->htmlId = (string) $this->id; } @@ -69,7 +70,7 @@ class Input extends Component $this->name = $this->modelBinding !== 'null' ? $this->modelBinding : (string) $this->id; } if ($this->type === 'password') { - $this->defaultClass = $this->defaultClass.' pr-[2.8rem]'; + $this->defaultClass = $this->defaultClass . ' pr-[2.8rem]'; } // $this->label = Str::title($this->label); diff --git a/resources/views/components/forms/input.blade.php b/resources/views/components/forms/input.blade.php index a329664a2..022e236d4 100644 --- a/resources/views/components/forms/input.blade.php +++ b/resources/views/components/forms/input.blade.php @@ -1,3 +1,8 @@ +@php + $hasSuffix = (isset($suffix) && $suffix instanceof \Illuminate\View\ComponentSlot && $suffix->isNotEmpty()) || ($suffix ?? null); + $inputClass = $hasSuffix ? $defaultClass . ' rounded-r-none border-r-0' : $defaultClass; +@endphp +