Skip to content

Commit

Permalink
Prevent lazyloading (#67)
Browse files Browse the repository at this point in the history
If not set, the relationship is not lazyloaded and you can get errors like 
```
Attempted to lazy load [versionable] on model [Overtrue\LaravelVersionable\Version] but lazy loading is disabled.```
if enforced.
  • Loading branch information
AlexisSerneels authored Apr 3, 2024
1 parent 57ea731 commit f72f143
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Version extends Model
'contents' => 'json',
];

protected $with = [
'versionable',
];

protected static function booted()
{
static::creating(function (Version $version) {
Expand Down

0 comments on commit f72f143

Please sign in to comment.