diff --git a/src/FoundationServiceProvider.php b/src/FoundationServiceProvider.php index 9aaa9b8..ad9e0cd 100644 --- a/src/FoundationServiceProvider.php +++ b/src/FoundationServiceProvider.php @@ -1,7 +1,6 @@ registerConfig(); $this->registerSidebarItems(); $this->registerProviders([ - CoreServiceProvider::class, Providers\PackagesServiceProvider::class, Providers\AuthorizationServiceProvider::class, ]); @@ -64,7 +64,7 @@ public function boot() { $this->registerProviders([ Providers\RouteServiceProvider::class, - Providers\ComposerServiceProvider::class, + Providers\ViewComposerServiceProvider::class, ]); // Publishes diff --git a/src/Providers/AuthorizationServiceProvider.php b/src/Providers/AuthorizationServiceProvider.php index 56603d1..673b729 100644 --- a/src/Providers/AuthorizationServiceProvider.php +++ b/src/Providers/AuthorizationServiceProvider.php @@ -3,7 +3,7 @@ use Arcanedev\Support\Providers\AuthorizationServiceProvider as ServiceProvider; use Arcanesoft\Contracts\Auth\Models\User; use Arcanesoft\Foundation\Policies; -use Illuminate\Contracts\Auth\Access\Gate as GateContract; +use Illuminate\Support\Facades\Gate; /** * Class AuthorizationServiceProvider @@ -19,30 +19,25 @@ class AuthorizationServiceProvider extends ServiceProvider */ /** * Register any application authentication / authorization services. - * - * @param \Illuminate\Contracts\Auth\Access\Gate $gate */ - public function boot(GateContract $gate) + public function boot() { - $this->registerPolicies($gate); + $this->registerPolicies(); /** @var \Illuminate\Auth\Access\Gate $gate */ - $gate->before(function (User $user, $ability) { + Gate::before(function (User $user, $ability) { return $user->isAdmin() ? true : null; }); - $this->registerLogViewerPolicies($gate); + $this->registerLogViewerPolicies(); } /** * Register LogViewer policies. - * - * @param \Illuminate\Contracts\Auth\Access\Gate $gate */ - private function registerLogViewerPolicies(GateContract $gate) + private function registerLogViewerPolicies() { $this->defineMany( - $gate, Policies\LogViewerPolicy::class, Policies\LogViewerPolicy::getPolicies() ); diff --git a/src/Providers/CommandServiceProvider.php b/src/Providers/CommandServiceProvider.php index 3f81411..03ccd73 100644 --- a/src/Providers/CommandServiceProvider.php +++ b/src/Providers/CommandServiceProvider.php @@ -1,6 +1,6 @@ commands($this->commands); - } - - /** - * Get the provided commands. - * - * @return array - */ - public function provides() - { - return $this->commands; - } } diff --git a/src/Providers/ComposerServiceProvider.php b/src/Providers/ComposerServiceProvider.php deleted file mode 100644 index 161dfad..0000000 --- a/src/Providers/ComposerServiceProvider.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -class ComposerServiceProvider extends ServiceProvider -{ - /* ------------------------------------------------------------------------------------------------ - | Main Functions - | ------------------------------------------------------------------------------------------------ - */ - /** - * {@inheritdoc} - */ - public function boot() - { - view()->composer( - \Arcanesoft\Foundation\ViewComposers\SidebarComposer::VIEW_NAME, - \Arcanesoft\Foundation\ViewComposers\SidebarComposer::class - ); - - view()->composer( - \Arcanesoft\Foundation\ViewComposers\System\ServerRequirementsComposer::VIEW_NAME, - \Arcanesoft\Foundation\ViewComposers\System\ServerRequirementsComposer::class - ); - - view()->composer( - \Arcanesoft\Foundation\ViewComposers\System\FoldersPermissionsComposer::VIEW_NAME, - \Arcanesoft\Foundation\ViewComposers\System\FoldersPermissionsComposer::class - ); - } - - /** - * {@inheritdoc} - */ - public function register() - { - // - } -} diff --git a/src/Providers/PackagesServiceProvider.php b/src/Providers/PackagesServiceProvider.php index d20ee6a..a8c07ef 100644 --- a/src/Providers/PackagesServiceProvider.php +++ b/src/Providers/PackagesServiceProvider.php @@ -3,6 +3,7 @@ use Arcanedev\LogViewer\LogViewerServiceProvider; use Arcanedev\RouteViewer\RouteViewerServiceProvider; use Arcanedev\Support\ServiceProvider; +use Spatie\Backup\BackupServiceProvider; /** * Class PackagesServiceProvider @@ -21,6 +22,8 @@ class PackagesServiceProvider extends ServiceProvider */ public function register() { + parent::register(); + $this->registerLogViewerPackage(); $this->registerRouteViewerPackage(); $this->registerBackupsPackage(); @@ -32,7 +35,7 @@ public function register() */ public function boot() { - // + parent::boot(); } /** @@ -86,8 +89,11 @@ private function registerRouteViewerPackage() $this->config()->set('route-viewer.route.enabled', false); } + /** + * Register the Backup package. + */ private function registerBackupsPackage() { - $this->registerProvider(\Spatie\Backup\BackupServiceProvider::class); + $this->registerProvider(BackupServiceProvider::class); } } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 446ff0d..4837fd8 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -2,7 +2,6 @@ use Arcanesoft\Core\Bases\RouteServiceProvider as ServiceProvider; use Arcanesoft\Foundation\Http\Routes; -use Illuminate\Contracts\Routing\Registrar as Router; /** * Class RouteServiceProvider @@ -18,12 +17,10 @@ class RouteServiceProvider extends ServiceProvider */ /** * Define the routes for the application. - * - * @param \Illuminate\Contracts\Routing\Registrar $router */ - public function map(Router $router) + public function map() { - $this->mapAdminRoutes($router); + $this->mapAdminRoutes(); } /* ------------------------------------------------------------------------------------------------ @@ -32,20 +29,18 @@ public function map(Router $router) */ /** * Map the admin routes. - * - * @param \Illuminate\Contracts\Routing\Registrar $router */ - private function mapAdminRoutes(Router $router) + private function mapAdminRoutes() { $attributes = $this->getAdminAttributes( 'foundation.', 'Arcanesoft\\Foundation\\Http\\Controllers\\Admin' ); - $router->group($attributes, function (Router $router) { - Routes\Admin\DashboardRoute::register($router); - Routes\Admin\SettingsRoutes::register($router); - Routes\Admin\SystemRoutes::register($router); + $this->group($attributes, function () { + Routes\Admin\DashboardRoute::register(); + Routes\Admin\SettingsRoutes::register(); + Routes\Admin\SystemRoutes::register(); }); } } diff --git a/src/Providers/ViewComposerServiceProvider.php b/src/Providers/ViewComposerServiceProvider.php new file mode 100644 index 0000000..bc22f74 --- /dev/null +++ b/src/Providers/ViewComposerServiceProvider.php @@ -0,0 +1,30 @@ + + */ +class ViewComposerServiceProvider extends ServiceProvider +{ + /* ------------------------------------------------------------------------------------------------ + | Properties + | ------------------------------------------------------------------------------------------------ + */ + /** + * Register the composer classes. + * + * @var array + */ + protected $composerClasses = [ + SidebarComposer::VIEW_NAME => SidebarComposer::class, + ServerRequirementsComposer::VIEW_NAME => ServerRequirementsComposer::class, + FoldersPermissionsComposer::VIEW_NAME => FoldersPermissionsComposer::class, + ]; +}