Skip to content

Commit fa681ed

Browse files
authored
Merge pull request whitecube#288 from marshmallow-packages/hotfix/nova-426-support
Fix for Nova v4.26.1
2 parents f700a28 + 80c2744 commit fa681ed

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Layouts/Layout.php

+20
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Exception;
77
use ArrayAccess;
88
use JsonSerializable;
9+
use Illuminate\Support\Arr;
10+
use Illuminate\Support\Str;
911
use Laravel\Nova\Fields\Field;
1012
use Laravel\Nova\Fields\Heading;
1113
use Illuminate\Database\Eloquent\Model;
@@ -846,4 +848,22 @@ public function toArray()
846848
{
847849
return $this->attributesToArray();
848850
}
851+
852+
853+
/**
854+
* Fill the model with an array of attributes.
855+
*
856+
* @param array $attributes
857+
* @return $this
858+
*/
859+
public function forceFill(array $attributes)
860+
{
861+
foreach ($attributes as $key => $value) {
862+
$attribute = Str::replace('->', '.', $key);
863+
864+
Arr::set($this->attributes, $attribute, $value);
865+
}
866+
867+
return $this;
868+
}
849869
}

0 commit comments

Comments
 (0)