@php // Determine the wire target from wire:click or use explicit wire:target if provided $wireTarget = null; if ($attributes->has('wire:target')) { $wireTarget = $attributes->get('wire:target'); } else { // Look for wire:click variants (wire:click, wire:click.prevent, etc.) foreach ($attributes->getAttributes() as $key => $value) { if (str_starts_with($key, 'wire:click')) { // Skip $dispatch, $set, $toggle etc. as they don't create loading states if (!str_starts_with(trim($value), '$')) { $wireTarget = $value; break; } } } } @endphp