Skip to content

Commit 5eb953e

Browse files
docs: document manual state access
1 parent 1812aeb commit 5eb953e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/pages/basic-usage.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ You can also use magic methods with for cleaner syntax:
133133
'name' => $this->unlessStateMinimal($this->full_name),
134134
```
135135

136+
### Manual State Access
137+
138+
If you need more complex logic than inline conditionals, you can access the resource's current state directly using the `getState()` method:
139+
140+
```php
141+
if ($this->getState() === 'full') {
142+
// Do something specific for the full state
143+
}
144+
```
145+
136146
## Using Stateful Resources
137147

138148
### Setting the State Explicitly

0 commit comments

Comments
 (0)