@php $tag = 'button'; $href = null; $buttonType = $type; if ($type === 'delete' || $confirm) { $tag = 'button'; $buttonType = 'button'; $attributes = $attributes->merge([ 'onclick' => "confirmDelete('$confirmUrl', '$confirmName')", ]); } elseif ($route) { $href = route($route, $params); $tag = 'a'; } elseif ($url) { $href = $url; $tag = 'a'; } elseif ($attributes->has('href')) { $href = $attributes->get('href'); $tag = 'a'; } $variants = [ 'primary' => 'btn-primary', 'secondary' => 'btn-secondary', 'outline' => 'btn-outline-primary', 'outline-primary' => 'btn-outline-primary', 'outline-secondary' => 'btn-outline-secondary', 'outline-success' => 'btn-outline-success', 'outline-danger' => 'btn-outline-danger', 'outline-warning' => 'btn-outline-warning', 'outline-info' => 'btn-outline-info', 'ghost' => 'btn-light', 'link' => 'btn-link', 'danger' => 'btn-danger', 'destructive' => 'btn-danger', 'success' => 'btn-success', 'warning' => 'btn-warning', 'info' => 'btn-info', 'light' => 'btn-light', 'dark' => 'btn-dark', ]; $sizes = [ 'default' => '', 'sm' => 'btn-sm', 'lg' => 'btn-lg', 'xs' => 'btn-xs', 'icon' => 'btn-icon', ]; $variantClass = $variants[$variant ?? 'primary'] ?? $variants['primary']; $sizeClass = $sizes[$size ?? 'default'] ?? ''; $classes = "btn d-flex align-items-center rounded-4 border {$variantClass} {$sizeClass}"; @endphp @if($tag === 'a') merge(['class' => $classes]) }}> @if($icon) @endif @if($slot->isNotEmpty()){{ $slot }}@endif @else @endif