--- name: livewire-development description: "Develops reactive Livewire 4 components. Activates when creating, updating, or modifying Livewire components; working with wire:model, wire:click, wire:loading, or any wire: directives; adding real-time updates, loading states, or reactivity; debugging component behavior; writing Livewire tests; or when the user mentions Livewire, component, counter, or reactive UI." license: MIT metadata: author: laravel --- @php /** @var \Laravel\Boost\Install\GuidelineAssist $assist */ @endphp # Livewire Development ## When to Apply Activate this skill when: - Creating or modifying Livewire components - Using wire: directives (model, click, loading, sort, intersect) - Implementing islands or async actions - Writing Livewire component tests ## Documentation Use `search-docs` for detailed Livewire 4 patterns and documentation. ## Basic Usage ### Creating Components ```bash # Single-file component (default in v4) {{ $assist->artisanCommand('make:livewire create-post') }} # Multi-file component {{ $assist->artisanCommand('make:livewire create-post --mfc') }} # Class-based component (v3 style) {{ $assist->artisanCommand('make:livewire create-post --class') }} # With namespace {{ $assist->artisanCommand('make:livewire Posts/CreatePost') }} ``` ### Converting Between Formats Use `{{ $assist->artisanCommand('livewire:convert create-post') }}` to convert between single-file, multi-file, and class-based formats. ### Choosing a Component Format Before creating a component, check `config/livewire.php` for directory overrides, which change where files are stored. Then, look at existing files in those directories (defaulting to `app/Livewire/` and `resources/views/livewire/`) to match the established convention. ### Component Format Reference | Format | Flag | Class Path | View Path | |--------|------|------------|-----------| | Single-file (SFC) | default | — | `resources/views/livewire/create-post.blade.php` (PHP + Blade in one file) | | Multi-file (MFC) | `--mfc` | `app/Livewire/CreatePost.php` | `resources/views/livewire/create-post.blade.php` | | Class-based | `--class` | `app/Livewire/CreatePost.php` | `resources/views/livewire/create-post.blade.php` | | View-based | ⚡ prefix | — | `resources/views/livewire/create-post.blade.php` (Blade-only with functional state) | Namespaced components map to subdirectories: `make:livewire Posts/CreatePost` creates files at `app/Livewire/Posts/CreatePost.php` and `resources/views/livewire/posts/create-post.blade.php`. ### Single-File Component Example @boostsnippet("Single-File Component Example", "php")
Fatal error: Uncaught Error: Class "Livewire\Component" not found in C:\laragon\www\cacsf-incidencias-client\vendor\laravel\boost\.ai\livewire\4\skill\livewire-development\SKILL.blade.php:69 Stack trace: #0 {main} thrown in C:\laragon\www\cacsf-incidencias-client\vendor\laravel\boost\.ai\livewire\4\skill\livewire-development\SKILL.blade.php on line 69