@@ -483,9 +483,9 @@ public function fill(array $columns): void
483483 $ fillable = $ this ->mapper ->getFillable ();
484484 $ guarded = $ this ->mapper ->getGuarded ();
485485
486- if (! empty ($ fillable )) {
486+ if (count ($ fillable ) > 0 ) {
487487 $ columns = array_intersect_key ($ columns , array_flip ($ fillable ));
488- } elseif (! empty ($ guarded )) {
488+ } elseif (count ($ guarded ) > 0 ) {
489489 $ columns = array_diff_key ($ columns , array_flip ($ guarded ));
490490 }
491491
@@ -502,7 +502,7 @@ public function fill(array $columns): void
502502 public function markAsSaved (mixed $ id ): bool
503503 {
504504 $ primaryKey = $ this ->mapper ->getPrimaryKey ();
505- if (! $ primaryKey ->isComposite ()) {
505+ if ($ primaryKey ->isComposite () === false ) {
506506 $ columns = $ primaryKey ->columns ();
507507 $ this ->rawColumns [$ columns [0 ]] = $ id ;
508508 } else {
@@ -515,7 +515,7 @@ public function markAsSaved(mixed $id): bool
515515 $ this ->isNew = false ;
516516 $ this ->modified = [];
517517
518- if (! empty ($ this ->pendingLinks )) {
518+ if (count ($ this ->pendingLinks ) > 0 ) {
519519 $ this ->executePendingLinkage ();
520520 }
521521
@@ -537,7 +537,11 @@ public function markAsUpdated(?string $updatedAt = null): bool
537537
538538 $ this ->modified = [];
539539
540- if (!empty ($ this ->pendingLinks )) {
540+ // some relation already loaded still in the cache
541+ // so force reload it
542+ $ this ->relations = [];
543+
544+ if (count ($ this ->pendingLinks ) > 0 ) {
541545 $ this ->executePendingLinkage ();
542546 }
543547
0 commit comments