phpvms/app/Providers/AppServiceProvider.php

80 lines
2.5 KiB
PHP
Raw Normal View History

2017-06-09 02:28:26 +08:00
<?php
2017-06-09 02:28:26 +08:00
namespace App\Providers;
use App\Models\Aircraft;
use App\Models\Airport;
use App\Models\Flight;
use App\Models\FlightField;
use App\Models\FlightFieldValue;
use App\Models\Journal;
use App\Models\JournalTransaction;
use App\Models\Observers\AircraftObserver;
use App\Models\Observers\AirportObserver;
use App\Models\Observers\FlightObserver;
use App\Models\Observers\JournalObserver;
use App\Models\Observers\JournalTransactionObserver;
use App\Models\Observers\SettingObserver;
2018-08-27 00:40:04 +08:00
use App\Models\Observers\Sluggable;
use App\Models\Observers\SubfleetObserver;
use App\Models\Observers\UserObserver;
use App\Models\PirepField;
use App\Models\PirepFieldValue;
use App\Models\Setting;
use App\Models\Subfleet;
use App\Models\User;
2018-02-21 12:33:09 +08:00
use App\Repositories\SettingRepository;
use App\Services\ModuleService;
use Illuminate\Support\Facades\Schema;
2017-06-09 02:28:26 +08:00
use Illuminate\Support\ServiceProvider;
use View;
2017-06-09 02:28:26 +08:00
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
2017-06-09 02:28:26 +08:00
{
Schema::defaultStringLength(191);
2018-05-02 09:58:05 +08:00
/*Carbon::serializeUsing(function ($carbon) {
2018-05-02 09:58:05 +08:00
return $carbon->format('U');
});*/
2018-05-02 09:58:05 +08:00
$this->app->bind('setting', SettingRepository::class);
View::share('moduleSvc', app(ModuleService::class));
// Model observers
Aircraft::observe(AircraftObserver::class);
Airport::observe(AirportObserver::class);
Journal::observe(JournalObserver::class);
JournalTransaction::observe(JournalTransactionObserver::class);
Flight::observe(FlightObserver::class);
FlightField::observe(Sluggable::class);
FlightFieldValue::observe(Sluggable::class);
PirepField::observe(Sluggable::class);
PirepFieldValue::observe(Sluggable::class);
Setting::observe(SettingObserver::class);
Subfleet::observe(SubfleetObserver::class);
User::observe(UserObserver::class);
2017-06-09 02:28:26 +08:00
}
/**
* Register any application services.
*/
public function register(): void
2017-06-09 02:28:26 +08:00
{
2018-08-27 00:40:04 +08:00
// Only dev environment stuff
if ($this->app->environment() === 'dev') {
2018-08-27 00:40:04 +08:00
// Only load the IDE helper if it's included. This lets use distribute the
// package without any dev dependencies
2018-08-27 02:51:47 +08:00
/* @noinspection NestedPositiveIfStatementsInspection */
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
}
2017-06-09 02:28:26 +08:00
}
}