Skip to content

Commit

Permalink
Stop throwing when lazy loading used in recently created model
Browse files Browse the repository at this point in the history
  • Loading branch information
rogatty committed Mar 18, 2022
1 parent ed33384 commit dd59f62
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
Expand Up @@ -519,6 +519,10 @@ protected function handleLazyLoadingViolation($key)
return call_user_func(static::$lazyLoadingViolationCallback, $this, $key);
}

if (!$this->exists || $this->wasRecentlyCreated) {
return;
}

throw new LazyLoadingViolationException($this, $key);
}

Expand Down

0 comments on commit dd59f62

Please sign in to comment.