Skip to content

Commit

Permalink
wip volt docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Oct 19, 2024
1 parent c978c28 commit 237bc2a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ $validated = $this->group('a')

```

### Usage in Livewire Volt
### Volt

In class-based components, property groups work like any other Livewite component.
When using Volt's functional API may use property groups like illustrated below.

```php

use Leuverink\PropertyAttribute\Group;
use Leuverink\PropertyAttribute\WithGroups;
use function Livewire\Volt\{action, state, uses};
Expand All @@ -132,14 +136,21 @@ state([

state([
'bar' => 2,
'baz' => 'Lorem',
])->attribute(Group::class, 'b');

$action = action(function() {
$groupA = $this->group('a');
$groupB = $this->group('b');
$groupA = $this->group('a')
->validate()
->values();

$groupB = $this->group('b')
->validate()
->values();

// ...
});

```

### Conflicting `group` method signature
Expand Down

0 comments on commit 237bc2a

Please sign in to comment.