Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit 6d6d7f2

Browse files
committed
update readme
1 parent dbc0c93 commit 6d6d7f2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,32 @@ composer require michael-rubel/laravel-loop-functions
2626
use LoopFunctions;
2727
```
2828

29-
Assign Eloquent model attributes to class properties:
29+
#### Assign Eloquent model attributes to class properties:
3030
```php
3131
$this->propertiesFrom($model);
3232
```
3333

34-
Assign array key values to class properties:
34+
#### Assign array key values to class properties:
3535
```php
3636
$this->propertiesFrom($array);
3737
```
3838

39-
Dump class properties:
39+
If you want to use dynamic properties, adjust the `dynamic_properties` key in the config and add the following methods if your class is not already implementing it:
40+
```php
41+
public function __get(string $name): mixed
42+
{
43+
return $this->{$name};
44+
}
45+
46+
public function __set(string $name, $value): void
47+
{
48+
$this->{$name} = $value;
49+
}
50+
```
51+
52+
`Note: if you use the Livewire components, it already has similar definitions under the hood.`
53+
54+
#### Dump class properties:
4055
```php
4156
$this->dumpProperties();
4257
```

0 commit comments

Comments
 (0)