This commit is contained in:
Pig Fang 2018-07-22 16:37:39 +08:00
parent e60d73b410
commit 26e81eba6e
3 changed files with 8 additions and 10 deletions

View File

@ -2,6 +2,7 @@
namespace App\Providers;
use View;
use Blade;
use Event;
use Utils;
@ -10,6 +11,7 @@ use App\Models\User;
use ReflectionException;
use Illuminate\Support\ServiceProvider;
use App\Exceptions\PrettyPageException;
use App\Services\Repositories\OptionRepository;
class AppServiceProvider extends ServiceProvider
{
@ -33,6 +35,8 @@ class AppServiceProvider extends ServiceProvider
$this->app['url']->forceScheme('https');
}
View::addExtension('tpl', 'blade');
Event::listen(Events\RenderingHeader::class, function($event) {
// Provide some application information for javascript
$blessing = array_merge(array_except(config('app'), ['key', 'providers', 'aliases', 'cipher', 'log', 'url']), [
@ -59,6 +63,7 @@ class AppServiceProvider extends ServiceProvider
{
$this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher'));
$this->app->singleton('users', \App\Services\Repositories\UserRepository::class);
$this->app->singleton('options', OptionRepository::class);
Blade::if('admin', function (User $user) {
return $user->isAdmin();

View File

@ -2,15 +2,10 @@
namespace App\Providers;
use DB;
use View;
use Utils;
use Illuminate\Http\Request;
use Composer\Semver\Comparator;
use Illuminate\Support\ServiceProvider;
use App\Exceptions\PrettyPageException;
use App\Http\Controllers\SetupController;
use App\Services\Repositories\OptionRepository;
class BootServiceProvider extends ServiceProvider
{
@ -51,8 +46,6 @@ class BootServiceProvider extends ServiceProvider
*/
public function register()
{
View::addExtension('tpl', 'blade');
$this->app->singleton('options', OptionRepository::class);
//
}
}

View File

@ -132,7 +132,7 @@ return [
'providers' => [
/*
/**
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
@ -157,7 +157,7 @@ return [
Illuminate\View\ViewServiceProvider::class,
/**
* Third-party libraries
* Third-party Libraries...
*/
Swiggles\Memcache\MemcacheServiceProvider::class,
Yajra\Datatables\DatatablesServiceProvider::class,