sentry integration for n+1

This commit is contained in:
Denis Duliçi 2023-05-31 10:01:17 +03:00
parent 15ebe1f20d
commit e938e8436b

View File

@ -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}].");
}
});
}
}