File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 44
55use Closure ;
66use Illuminate \Contracts \Support \Arrayable ;
7- use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
8- use Illuminate \Database \Eloquent \Model ;
97use Illuminate \Database \Query \Builder as QueryBuilder ;
108use Illuminate \Support \Fluent ;
119use Illuminate \Support \Str ;
@@ -323,7 +321,11 @@ public function compare(bool $value): static
323321 */
324322 public function opts (array $ value ): static
325323 {
326- $ this ->attributes ['opts ' ] = $ value ;
324+ if (! isset ($ this ->attributes ['opts ' ])) {
325+ $ this ->attributes ['opts ' ] = $ value ;
326+ } else {
327+ $ this ->attributes ['opts ' ] = array_merge_recursive ((array ) $ this ->attributes ['opts ' ], $ value );
328+ }
327329
328330 return $ this ;
329331 }
@@ -338,8 +340,10 @@ public function opts(array $value): static
338340 */
339341 public function attr (string $ attribute , int |bool |string $ value ): static
340342 {
341- // @phpstan-ignore-next-line
342- $ this ->attributes ['attr ' ][$ attribute ] = $ value ;
343+ $ attributes = (array ) $ this ->attributes ['attr ' ];
344+ $ attributes [$ attribute ] = $ value ;
345+
346+ $ this ->attributes ['attr ' ] = $ attributes ;
343347
344348 return $ this ;
345349 }
You can’t perform that action at this time.
0 commit comments