canGate && $this->canResource && $this->autoDisable) { $hasPermission = Gate::allows($this->canGate, $this->canResource); if (! $hasPermission) { $this->disabled = true; $this->instantSave = false; // Disable instant save for unauthorized users } } if ($this->disabled) { $this->defaultClass .= ' opacity-40'; } } /** * Get the view / contents that represent the component. */ public function render(): View|Closure|string { // Store original ID for wire:model binding (property name) $this->modelBinding = $this->id; // Generate unique HTML ID by adding random suffix // This prevents duplicate IDs when multiple forms are on the same page if ($this->id) { $uniqueSuffix = new Cuid2; $this->htmlId = $this->id.'-'.$uniqueSuffix; } else { $this->htmlId = $this->id; } return view('components.forms.checkbox'); } }