@php extract(Flux::forwardedAttributes($attributes, [ 'type', 'current', 'href', 'as', ])); @endphp @props([ 'type' => 'button', 'current' => null, 'href' => null, 'as' => null, ]) @php $hrefForCurrentDetection = str($href)->startsWith(trim(config('app.url'))) ? (string) str($href)->after(trim(config('app.url'), '/')) : $href; if ($hrefForCurrentDetection === '') $hrefForCurrentDetection = '/'; $requestIs = function ($pattern) { // Support current route detection during Livewire update requests as well... return app('livewire')?->isLivewireRequest() ? str()->is($pattern, app('livewire')->originalPath()) : request()->is($pattern); }; $current = $current === null ? ($hrefForCurrentDetection ? $requestIs($hrefForCurrentDetection === '/' ? '/' : trim($hrefForCurrentDetection, '/')) : false) : $current; @endphp