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

Commit 99e9d69

Browse files
committed
reuse code
1 parent 6b50d84 commit 99e9d69

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Traits/LoopFunctions.php

+6-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ public function attributesToProperties(?Model $model = null, mixed $rescue = nul
2323
if (! is_null($model)) {
2424
collect($model->getAttributes())
2525
->except($this->ignoreKeys())
26-
->each(function ($value, $property) use ($model, $rescue) {
27-
if (property_exists($this, $property)) {
28-
rescue(
29-
fn () => $this->{$property} = $model->{$property},
30-
$rescue,
31-
config('loop-functions.log') ?? false
32-
);
33-
}
34-
});
26+
->each(
27+
fn ($value, $property) => $this->assignValue(
28+
$property,
29+
$model->{$property}
30+
)
31+
);
3532
}
3633
}
3734

0 commit comments

Comments
 (0)