From 237bc2a4727f3b6bae4436b31ed5b72ba0f154ac Mon Sep 17 00:00:00 2001 From: gwleuverink Date: Sun, 20 Oct 2024 00:04:37 +0200 Subject: [PATCH] wip volt docs --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6734a38..cb964a6 100644 --- a/README.md +++ b/README.md @@ -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}; @@ -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