2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
2016-04-07 13:21:09 -07:00
|
|
|
namespace App\Providers;
|
|
|
|
|
2017-11-06 21:17:17 -08:00
|
|
|
|
2016-04-07 13:21:09 -07:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2016-11-30 20:38:46 -08:00
|
|
|
use Log;
|
2017-02-17 18:30:48 -08:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
2017-06-15 20:54:14 -07:00
|
|
|
use App\Observers\AssetObserver;
|
|
|
|
use App\Observers\LicenseObserver;
|
|
|
|
use App\Observers\AccessoryObserver;
|
|
|
|
use App\Observers\ConsumableObserver;
|
|
|
|
use App\Observers\ComponentObserver;
|
|
|
|
use App\Models\Asset;
|
|
|
|
use App\Models\License;
|
|
|
|
use App\Models\Accessory;
|
|
|
|
use App\Models\Consumable;
|
|
|
|
use App\Models\Component;
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
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);
|
2017-01-10 16:19:18 -08:00
|
|
|
|
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2016-11-30 20:38:46 -08:00
|
|
|
$monolog = Log::getMonolog();
|
2017-10-27 17:00:33 -07:00
|
|
|
$log_level = config('app.log_level');
|
2016-11-30 20:38:46 -08:00
|
|
|
|
2017-10-02 20:27:45 -07:00
|
|
|
if (($this->app->environment('production')) && (config('services.rollbar.access_token'))){
|
2018-10-04 12:11:27 -07:00
|
|
|
$this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
|
2017-10-02 20:27:45 -07:00
|
|
|
}
|
2018-10-04 12:11:27 -07:00
|
|
|
|
2016-12-29 14:02:18 -08:00
|
|
|
foreach ($monolog->getHandlers() as $handler) {
|
2016-11-30 20:38:46 -08:00
|
|
|
$handler->setLevel($log_level);
|
|
|
|
}
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
}
|