log lazy loading cases
This commit is contained in:
parent
96995e8ec7
commit
62c08868a8
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Pagination\Paginator;
|
use Illuminate\Pagination\Paginator;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\ServiceProvider as Provider;
|
use Illuminate\Support\ServiceProvider as Provider;
|
||||||
@ -35,5 +36,13 @@ class App extends Provider
|
|||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
|
||||||
Paginator::useBootstrap();
|
Paginator::useBootstrap();
|
||||||
|
|
||||||
|
Model::preventLazyLoading();
|
||||||
|
|
||||||
|
Model::handleLazyLoadingViolationUsing(function ($model, $relation) {
|
||||||
|
$class = get_class($model);
|
||||||
|
|
||||||
|
logger("Attempted to lazy load [{$relation}] on model [{$class}].");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user