From f72f143869f88f791651a7538a703294f3486ac5 Mon Sep 17 00:00:00 2001 From: Alexis <287688+AlexisSerneels@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:40:25 +0200 Subject: [PATCH] Prevent lazyloading (#67) 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. --- src/Version.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Version.php b/src/Version.php index 5cf072f..2b20dff 100644 --- a/src/Version.php +++ b/src/Version.php @@ -36,6 +36,10 @@ class Version extends Model 'contents' => 'json', ]; + protected $with = [ + 'versionable', + ]; + protected static function booted() { static::creating(function (Version $version) {