gps_system/resources/views/flux/with-field.blade.php
sackey 6b878bb0a0
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
Initial commit
2025-09-12 16:19:56 +00:00

42 lines
1.3 KiB
PHP

@php
extract(Flux::forwardedAttributes($attributes, [
'name',
'descriptionTrailing',
'description',
'label',
'badge',
]));
@endphp
@php $descriptionTrailing = $descriptionTrailing ??= $attributes->pluck('description:trailing'); @endphp
@props([
'name' => $attributes->whereStartsWith('wire:model')->first(),
'descriptionTrailing' => null,
'description' => null,
'label' => null,
'badge' => null,
])
<?php if (isset($label) || isset($description)): ?>
<flux:field :attributes="Flux::attributesAfter('field:', $attributes, [])">
<?php if (isset($label)): ?>
<flux:label :attributes="Flux::attributesAfter('label:', $attributes, ['badge' => $badge])">{{ $label }}</flux:label>
<?php endif; ?>
<?php if (isset($description)): ?>
<flux:description :attributes="Flux::attributesAfter('description:', $attributes, [])">{{ $description }}</flux:description>
<?php endif; ?>
{{ $slot }}
<flux:error :attributes="Flux::attributesAfter('error:', $attributes, ['name' => $name])" />
<?php if (isset($descriptionTrailing)): ?>
<flux:description :attributes="Flux::attributesAfter('description:', $attributes, [])">{{ $descriptionTrailing }}</flux:description>
<?php endif; ?>
</flux:field>
<?php else: ?>
{{ $slot }}
<?php endif; ?>