Skip to content

Commit 3c127ab

Browse files
committed
Add ability to set data value
1 parent dfa369a commit 3c127ab

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Data.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ public function __construct(iterable $attributes = [])
2323
}
2424
}
2525

26+
/**
27+
* Set an attribute on the data instance using "dot" notation.
28+
*/
29+
public function set(string $key, mixed $value): static
30+
{
31+
data_set($this->attributes, $key, $value);
32+
33+
return $this;
34+
}
35+
2636
/**
2737
* Get an attribute from the data instance using "dot" notation.
2838
*/

0 commit comments

Comments
 (0)