2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
2016-04-07 13:21:09 -07:00
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
namespace App\Providers;
|
2017-11-06 21:17:17 -08:00
|
|
|
|
2019-03-13 20:12:03 -07:00
|
|
|
use App\Models\Accessory;
|
|
|
|
use App\Models\Asset;
|
|
|
|
use App\Models\Component;
|
|
|
|
use App\Models\Consumable;
|
|
|
|
use App\Models\License;
|
2019-03-13 10:58:35 -07:00
|
|
|
use App\Models\Setting;
|
2017-06-15 20:54:14 -07:00
|
|
|
use App\Observers\AccessoryObserver;
|
2019-03-13 20:12:03 -07:00
|
|
|
use App\Observers\AssetObserver;
|
2017-06-15 20:54:14 -07:00
|
|
|
use App\Observers\ComponentObserver;
|
2019-03-13 20:12:03 -07:00
|
|
|
use App\Observers\ConsumableObserver;
|
|
|
|
use App\Observers\LicenseObserver;
|
|
|
|
use App\Observers\SettingObserver;
|
2021-06-10 13:15:52 -07:00
|
|
|
use Illuminate\Routing\UrlGenerator;
|
2019-03-13 20:12:03 -07:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
2016-04-07 13:21:09 -07:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
/**
|
2017-11-06 21:17:17 -08:00
|
|
|
* This service provider handles setting the observers on models
|
2016-03-25 01:18:05 -07:00
|
|
|
*
|
|
|
|
* PHP version 5.5.9
|
|
|
|
* @version v3.0
|
|
|
|
*/
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Custom email array validation
|
|
|
|
*
|
|
|
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
|
|
|
* @since [v3.0]
|
|
|
|
* @return void
|
|
|
|
*/
|
2021-04-05 21:56:25 -07:00
|
|
|
public function boot(UrlGenerator $url)
|
2016-03-25 01:18:05 -07:00
|
|
|
{
|
2021-04-05 21:56:25 -07:00
|
|
|
if (env('APP_FORCE_TLS')) {
|
|
|
|
if (strpos(env('APP_URL'), 'https') === 0) {
|
|
|
|
$url->forceScheme('https');
|
|
|
|
} else {
|
|
|
|
\Log::warning("'APP_FORCE_TLS' is set to true, but 'APP_URL' does not start with 'https://'. Will not force TLS on connections.");
|
|
|
|
}
|
|
|
|
}
|
2021-06-11 14:07:50 -07:00
|
|
|
|
|
|
|
\Illuminate\Pagination\Paginator::useBootstrap();
|
|
|
|
|
2017-02-17 18:26:53 -08:00
|
|
|
Schema::defaultStringLength(191);
|
2017-06-15 20:54:14 -07:00
|
|
|
Asset::observe(AssetObserver::class);
|
|
|
|
Accessory::observe(AccessoryObserver::class);
|
|
|
|
Component::observe(ComponentObserver::class);
|
|
|
|
Consumable::observe(ConsumableObserver::class);
|
|
|
|
License::observe(LicenseObserver::class);
|
2019-03-13 10:58:35 -07:00
|
|
|
Setting::observe(SettingObserver::class);
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2021-11-30 20:09:29 -08:00
|
|
|
// Only load rollbar if there is a rollbar key and the app is in production
|
2021-06-10 13:15:52 -07:00
|
|
|
if (($this->app->environment('production')) && (config('logging.channels.rollbar.access_token'))) {
|
2017-11-06 20:04:50 -08:00
|
|
|
$this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
|
2021-11-30 20:09:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Only load dusk's service provider if the app is in local or develop mode
|
|
|
|
if ($this->app->environment(['local', 'develop'])) {
|
|
|
|
$this->app->register(\Laravel\Dusk\DuskServiceProvider::class);
|
|
|
|
}
|
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
}
|