laravel-learn-bbs/app/Providers/AppServiceProvider.php

42 lines
916 B
PHP
Raw Normal View History

2017-12-24 14:17:18 +00:00
<?php
namespace App\Providers;
2018-01-15 15:59:30 +00:00
use App\Models\Reply;
2018-01-01 12:18:33 +00:00
use App\Models\Topic;
2018-01-15 15:59:30 +00:00
use App\Observers\ReplyObserver;
2018-01-01 12:18:33 +00:00
use App\Observers\TopicObserver;
2017-12-30 20:23:09 +00:00
use Carbon\Carbon;
2017-12-24 14:17:18 +00:00
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
2017-12-30 20:23:09 +00:00
Carbon::setLocale('zh');
2018-01-01 12:18:33 +00:00
Topic::observe(new TopicObserver());
2018-01-15 15:59:30 +00:00
Reply::observe(new ReplyObserver());
2018-01-01 12:18:33 +00:00
2017-12-24 14:17:18 +00:00
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
2018-01-01 04:38:52 +00:00
if ($this->app->environment() !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
2018-02-12 13:39:52 +00:00
if (app()->isLocal()) {
$this->app->register(\VIACreative\SudoSu\ServiceProvider::class);
}
2017-12-24 14:17:18 +00:00
}
}