File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/Illuminate/Database/Eloquent/Concerns Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -439,7 +439,7 @@ public function getRelationValue($key)
439
439
}
440
440
441
441
if ($ this ->preventsLazyLoading ) {
442
- throw new LazyLoadingViolationException ( $ this , $ key );
442
+ $ this -> violatedLazyLoading ( $ key );
443
443
}
444
444
445
445
// If the "attribute" exists as a method on the model, we will just assume
@@ -460,6 +460,17 @@ public function isRelation($key)
460
460
(static ::$ relationResolvers [get_class ($ this )][$ key ] ?? null );
461
461
}
462
462
463
+ /**
464
+ * Handle a lazy loading violation, for example by throwing an exception.
465
+ *
466
+ * @param string $key
467
+ * @return void
468
+ */
469
+ protected function violatedLazyLoading ($ key )
470
+ {
471
+ throw new LazyLoadingViolationException ($ this , $ key );
472
+ }
473
+
463
474
/**
464
475
* Get a relationship value from a method.
465
476
*
You can’t perform that action at this time.
0 commit comments