Skip to content

Commit 39c4d5e

Browse files
author
liutao
committed
support before and after fill
1 parent 675d735 commit 39c4d5e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Data.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static function from($data): static
5353
*/
5454
public function fill(array $data): static
5555
{
56+
$this->beforeFill($data);
5657
if (empty($data)) {
5758
return $this;
5859
}
@@ -90,6 +91,7 @@ public function fill(array $data): static
9091
}
9192
}
9293
}
94+
$this->afterFill($data);
9395
return $this;
9496
}
9597

@@ -172,4 +174,8 @@ protected function isArrayAble($data): bool
172174
{
173175
return $data instanceof ArrayAble || is_object($data) && method_exists($data, 'toArray');
174176
}
177+
178+
protected function beforeFill(array $data): void {}
179+
180+
protected function afterFill(array $data) {}
175181
}

0 commit comments

Comments
 (0)