49 lines
1.1 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace App\Providers;
2021-06-07 16:09:47 +03:00
use Illuminate\Database\Eloquent\Model;
2020-10-14 17:07:59 +03:00
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
2019-11-16 10:21:14 +03:00
use Illuminate\Support\ServiceProvider as Provider;
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
class App extends Provider
2017-09-14 22:21:00 +03:00
{
/**
2020-10-14 17:07:59 +03:00
* Register any application services.
2017-09-14 22:21:00 +03:00
*
* @return void
*/
2020-10-14 17:07:59 +03:00
public function register()
2017-09-14 22:21:00 +03:00
{
2020-10-14 17:07:59 +03:00
if (config('app.installed') && config('app.debug')) {
$this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
}
2019-11-16 10:21:14 +03:00
2020-10-14 17:07:59 +03:00
if (config('app.env') !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
2019-12-13 19:27:14 +03:00
}
2017-09-14 22:21:00 +03:00
}
/**
2020-10-14 17:07:59 +03:00
* Bootstrap any application services.
2017-09-14 22:21:00 +03:00
*
* @return void
*/
2020-10-14 17:07:59 +03:00
public function boot()
2017-09-14 22:21:00 +03:00
{
2020-10-14 17:07:59 +03:00
// Laravel db fix
Schema::defaultStringLength(191);
2017-09-14 22:21:00 +03:00
2020-10-14 17:07:59 +03:00
Paginator::useBootstrap();
2021-06-07 16:09:47 +03:00
Model::preventLazyLoading();
Model::handleLazyLoadingViolationUsing(function ($model, $relation) {
$class = get_class($model);
logger("Attempted to lazy load [{$relation}] on model [{$class}].");
});
2017-09-14 22:21:00 +03:00
}
}