File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Closure ;
6
6
use Illuminate \Contracts \Support \Arrayable ;
7
- use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
8
- use Illuminate \Database \Eloquent \Model ;
9
7
use Illuminate \Database \Query \Builder as QueryBuilder ;
10
8
use Illuminate \Support \Fluent ;
11
9
use Illuminate \Support \Str ;
@@ -323,7 +321,11 @@ public function compare(bool $value): static
323
321
*/
324
322
public function opts (array $ value ): static
325
323
{
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
+ }
327
329
328
330
return $ this ;
329
331
}
@@ -338,8 +340,10 @@ public function opts(array $value): static
338
340
*/
339
341
public function attr (string $ attribute , int |bool |string $ value ): static
340
342
{
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 ;
343
347
344
348
return $ this ;
345
349
}
You can’t perform that action at this time.
0 commit comments