diff --git a/app/Providers/App.php b/app/Providers/App.php index 8a40fbc7f..4627ef62c 100644 --- a/app/Providers/App.php +++ b/app/Providers/App.php @@ -43,9 +43,13 @@ class App extends Provider Model::preventLazyLoading(config('app.eager_load')); Model::handleLazyLoadingViolationUsing(function ($model, $relation) { - $class = get_class($model); - - report("Attempted to lazy load [{$relation}] on model [{$class}]."); + if (config('logging.default') == 'sentry') { + \Sentry\Laravel\Integration::lazyLoadingViolationReporter(); + } else { + $class = get_class($model); + + report("Attempted to lazy load [{$relation}] on model [{$class}]."); + } }); } }