livewire: Volt entfernt — Komponenten als Livewire-4-Single-File-Components, Route::livewire(), Livewire::test(); livewire/volt deinstalliert
- 83 Komponenten: Livewire\Volt\Component → Livewire\Component
- 73 Routen (admin, auth, customer): Volt::route() → Route::livewire()
- 88 Testdateien: Volt::test/actingAs → Livewire::test/actingAs
- VoltServiceProvider gelöscht; composer remove livewire/volt
- config/livewire.php auf v4-Schlüssel (component_layout, component_placeholder,
component_locations, make_command: SFC ohne ⚡). Der alte Schlüssel layout war
wirkungslos; alle gerouteten Komponenten setzen ihr Layout selbst.
- CLAUDE.md, AGENTS.md, boost.json, .cursorrules, Skill volt-development
- Roadmap: erledigt; Larastan erfasst SFCs weiterhin nicht (Blade-Dateien)
Suite 2.325 grün, einer übersprungen; Larastan und Pint ohne Meldung;
route:cache und view:cache laufen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5782297dca
commit
2cde7284a1
186 changed files with 889 additions and 1075 deletions
|
|
@ -1,88 +0,0 @@
|
|||
---
|
||||
name: volt-development
|
||||
description: "Develops single-file Livewire components with Volt. Activates when creating Volt components, converting Livewire to Volt, working with @volt directive, functional or class-based Volt APIs; or when the user mentions Volt, single-file components, functional Livewire, or inline component logic in Blade files."
|
||||
license: MIT
|
||||
metadata:
|
||||
author: laravel
|
||||
---
|
||||
|
||||
# Volt Development
|
||||
|
||||
## Documentation
|
||||
|
||||
Use `search-docs` for detailed Volt patterns and documentation.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Create components with `vendor/bin/sail artisan make:volt [name] [--test] [--pest]`.
|
||||
|
||||
Important: Check existing Volt components to determine if they use functional or class-based style before creating new ones.
|
||||
|
||||
### Functional Components
|
||||
|
||||
<!-- Volt Functional Component -->
|
||||
```php
|
||||
@@volt
|
||||
<?php
|
||||
use function Livewire\Volt\{state, computed};
|
||||
|
||||
state(['count' => 0]);
|
||||
|
||||
$increment = fn () => $this->count++;
|
||||
$double = computed(fn () => $this->count * 2);
|
||||
?>
|
||||
|
||||
<div>
|
||||
<h1>Count: @{{ $count }} (Double: @{{ $this->double }})</h1>
|
||||
<button wire:click="increment">+</button>
|
||||
</div>
|
||||
@@endvolt
|
||||
```
|
||||
|
||||
### Class-Based Components
|
||||
|
||||
<!-- Volt Class-based Component -->
|
||||
```php
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component {
|
||||
public int $count = 0;
|
||||
|
||||
public function increment(): void
|
||||
{
|
||||
$this->count++;
|
||||
}
|
||||
} ?>
|
||||
|
||||
<div>
|
||||
<h1>@{{ $count }}</h1>
|
||||
<button wire:click="increment">+</button>
|
||||
</div>
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Tests go in existing Volt test directory or `tests/Feature/Volt`:
|
||||
|
||||
<!-- Volt Test Example -->
|
||||
```php
|
||||
use Livewire\Volt\Volt;
|
||||
|
||||
test('counter increments', function () {
|
||||
Volt::test('counter')
|
||||
->assertSee('Count: 0')
|
||||
->call('increment')
|
||||
->assertSee('Count: 1');
|
||||
});
|
||||
```
|
||||
|
||||
## Verification
|
||||
|
||||
1. Check existing components for functional vs class-based style
|
||||
2. Test component with `Volt::test()`
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
- Not checking existing style (functional vs class-based) before creating
|
||||
- Forgetting `@volt` directive wrapper
|
||||
- Missing `--test` or `--pest` flag when tests are needed
|
||||
Loading…
Add table
Add a link
Reference in a new issue