You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,13 +13,11 @@ This application is a Laravel application and its main Laravel ecosystems packag
13
13
- laravel/framework (LARAVEL) - v12
14
14
- laravel/prompts (PROMPTS) - v0
15
15
- livewire/livewire (LIVEWIRE) - v3
16
-
- livewire/volt (VOLT) - v1
17
-
- laravel/breeze (BREEZE) - v2
18
16
- laravel/mcp (MCP) - v0
19
17
- laravel/pint (PINT) - v1
20
18
- laravel/sail (SAIL) - v1
21
19
- phpunit/phpunit (PHPUNIT) - v11
22
-
- tailwindcss (TAILWINDCSS) - v3
20
+
- tailwindcss (TAILWINDCSS) - v4
23
21
24
22
## Conventions
25
23
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
@@ -84,6 +82,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
84
82
85
83
## PHP
86
84
85
+
- Always use strict typing at the head of a `.php` file: `declare(strict_types=1);`.
87
86
- Always use curly braces for control structures, even if it has one line.
88
87
89
88
### Constructors
@@ -271,139 +270,6 @@ document.addEventListener('livewire:init', function () {
271
270
</code-snippet>
272
271
273
272
274
-
=== volt/core rules ===
275
-
276
-
## Livewire Volt
277
-
278
-
- This project uses Livewire Volt for interactivity within its pages. New pages requiring interactivity must also use Livewire Volt. There is documentation available for it.
279
-
- Make new Volt components using `php artisan make:volt [name] [--test] [--pest]`
280
-
- Volt is a **class-based** and **functional** API for Livewire that supports single-file components, allowing a component's PHP logic and Blade templates to co-exist in the same file
281
-
- Livewire Volt allows PHP logic and Blade templates in one file. Components use the `@volt` directive.
282
-
- You must check existing Volt components to determine if they're functional or class based. If you can't detect that, ask the user which they prefer before writing a Volt component.
To get started, define an anonymous class that extends Livewire\Volt\Component. Within the class, you may utilize all of the features of Livewire using traditional Livewire syntax:
311
-
312
-
313
-
<code-snippet name="Volt Class-based Volt Component Example" lang="php">
314
-
use Livewire\Volt\Component;
315
-
316
-
new class extends Component {
317
-
public $count = 0;
318
-
319
-
public function increment()
320
-
{
321
-
$this->count++;
322
-
}
323
-
} ?>
324
-
325
-
<div>
326
-
<h1>{{ $count }}</h1>
327
-
<button wire:click="increment">+</button>
328
-
</div>
329
-
</code-snippet>
330
-
331
-
332
-
### Testing Volt & Volt Components
333
-
- Use the existing directory for tests if it already exists. Otherwise, fallback to `tests/Feature/Volt`.
334
-
335
-
<code-snippet name="Livewire Test Example" lang="php">
336
-
use Livewire\Volt\Volt;
337
-
338
-
test('counter increments', function () {
339
-
Volt::test('counter')
340
-
->assertSee('Count: 0')
341
-
->call('increment')
342
-
->assertSee('Count: 1');
343
-
});
344
-
</code-snippet>
345
-
346
-
347
-
<code-snippet name="Volt Component Test Using Pest" lang="php">
348
-
declare(strict_types=1);
349
-
350
-
use App\Models\{User, Product};
351
-
use Livewire\Volt\Volt;
352
-
353
-
test('product form creates product', function () {
0 commit comments