Adjust service providers

This commit is contained in:
printempw 2018-07-22 11:20:15 +08:00
parent 5ae53acbb9
commit 05cd77e963
3 changed files with 18 additions and 16 deletions

View File

@ -2,12 +2,16 @@
namespace App\Providers; namespace App\Providers;
use View;
use Event; use Event;
use Utils; use Utils;
use Parsedown;
use App\Events; use App\Events;
use ReflectionException; use ReflectionException;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use App\Exceptions\PrettyPageException; use App\Exceptions\PrettyPageException;
use App\Services\Repositories\UserRepository;
use App\Services\Repositories\OptionRepository;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
@ -31,6 +35,8 @@ class AppServiceProvider extends ServiceProvider
$this->app['url']->forceSchema('https'); $this->app['url']->forceSchema('https');
} }
View::addExtension('tpl', 'blade');
Event::listen(Events\RenderingHeader::class, function($event) { Event::listen(Events\RenderingHeader::class, function($event) {
// Provide some application information for javascript // Provide some application information for javascript
$blessing = array_merge(array_except(config('app'), ['key', 'providers', 'aliases', 'cipher', 'log', 'url']), [ $blessing = array_merge(array_except(config('app'), ['key', 'providers', 'aliases', 'cipher', 'log', 'url']), [
@ -56,7 +62,8 @@ class AppServiceProvider extends ServiceProvider
public function register() public function register()
{ {
$this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher')); $this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
$this->app->singleton('users', \App\Services\Repositories\UserRepository::class); $this->app->singleton('parsedown', Parsedown::class);
$this->app->singleton('parsedown', \Parsedown::class); $this->app->singleton('users', UserRepository::class);
$this->app->singleton('options', OptionRepository::class);
} }
} }

View File

@ -3,16 +3,13 @@
namespace App\Providers; namespace App\Providers;
use DB; use DB;
use View;
use Utils;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Composer\Semver\Comparator; use Composer\Semver\Comparator;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use App\Exceptions\PrettyPageException; use App\Exceptions\PrettyPageException;
use App\Http\Controllers\SetupController; use App\Http\Controllers\SetupController;
use App\Services\Repositories\OptionRepository;
class BootServiceProvider extends ServiceProvider class RuntimeCheckServiceProvider extends ServiceProvider
{ {
/** /**
* Bootstrap any application services. * Bootstrap any application services.
@ -95,8 +92,6 @@ class BootServiceProvider extends ServiceProvider
*/ */
public function register() public function register()
{ {
View::addExtension('tpl', 'blade'); //
$this->app->singleton('options', OptionRepository::class);
} }
} }

View File

@ -132,7 +132,7 @@ return [
'providers' => [ 'providers' => [
/* /**
* Laravel Framework Service Providers... * Laravel Framework Service Providers...
*/ */
Illuminate\Auth\AuthServiceProvider::class, Illuminate\Auth\AuthServiceProvider::class,
@ -157,7 +157,7 @@ return [
Illuminate\View\ViewServiceProvider::class, Illuminate\View\ViewServiceProvider::class,
/** /**
* Third-party libraries * Third-party Libraries...
*/ */
Swiggles\Memcache\MemcacheServiceProvider::class, Swiggles\Memcache\MemcacheServiceProvider::class,
Yajra\Datatables\DatatablesServiceProvider::class, Yajra\Datatables\DatatablesServiceProvider::class,
@ -165,15 +165,15 @@ return [
/** /**
* Application Service Providers... * Application Service Providers...
*/ */
App\Providers\BootServiceProvider::class,
App\Providers\AppServiceProvider::class, App\Providers\AppServiceProvider::class,
App\Providers\LogServiceProvider::class,
App\Providers\PluginServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\LogServiceProvider::class,
App\Providers\MemoryServiceProvider::class, App\Providers\MemoryServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\PluginServiceProvider::class,
App\Providers\TranslationServiceProvider::class,
App\Providers\ResponseMacroServiceProvider::class, App\Providers\ResponseMacroServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\RuntimeCheckServiceProvider::class,
App\Providers\TranslationServiceProvider::class,
App\Providers\ValidatorExtendServiceProvider::class, App\Providers\ValidatorExtendServiceProvider::class,
], ],