|
|
@@ -74,17 +74,6 @@ class AdminServiceProvider extends ServiceProvider
|
|
|
],
|
|
|
];
|
|
|
|
|
|
- public function boot()
|
|
|
- {
|
|
|
- $this->registerDefaultSections();
|
|
|
- $this->registerViews();
|
|
|
- $this->ensureHttps();
|
|
|
- $this->bootApplication();
|
|
|
- $this->registerPublishing();
|
|
|
- $this->compatibleBlade();
|
|
|
- $this->bootExtensions();
|
|
|
- }
|
|
|
-
|
|
|
public function register()
|
|
|
{
|
|
|
require_once __DIR__.'/Support/AdminSection.php';
|
|
|
@@ -102,6 +91,18 @@ class AdminServiceProvider extends ServiceProvider
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function boot()
|
|
|
+ {
|
|
|
+ $this->registerDefaultSections();
|
|
|
+ $this->registerViews();
|
|
|
+ $this->ensureHttps();
|
|
|
+ $this->bootApplication();
|
|
|
+ $this->registerPublishing();
|
|
|
+ $this->compatibleBlade();
|
|
|
+ $this->bootExtensions();
|
|
|
+ $this->registerBladeDirective();
|
|
|
+ }
|
|
|
+
|
|
|
protected function aliasAdmin()
|
|
|
{
|
|
|
if (! class_exists(\Admin::class)) {
|
|
|
@@ -228,6 +229,25 @@ class AdminServiceProvider extends ServiceProvider
|
|
|
Admin::extensions()->boot();
|
|
|
}
|
|
|
|
|
|
+ protected function registerBladeDirective()
|
|
|
+ {
|
|
|
+ Blade::directive('color', function ($color = 'primary', $amt = 0) {
|
|
|
+ $color = $amt ? admin_color()->darken($color, $amt) : admin_color($color);
|
|
|
+
|
|
|
+ return <<<PHP
|
|
|
+<?php echo "{$color}";?>
|
|
|
+PHP;
|
|
|
+ });
|
|
|
+
|
|
|
+ Blade::directive('primary', function ($amt = 0) {
|
|
|
+ $color = $amt ? admin_color()->darken('primary', $amt) : admin_color('primary');
|
|
|
+
|
|
|
+ return <<<PHP
|
|
|
+<?php echo "{$color}";?>
|
|
|
+PHP;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 路由中间件注册.
|
|
|
*
|