Skip to content

Commit

Permalink
[FIX] Refactor ServiceProvider.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seiger committed Sep 7, 2024
1 parent b6b09d8 commit 3d1b90d
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/sGalleryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public function boot()
{
// Only load these resources in Manager mode
if (IN_MANAGER_MODE) {
// Add custom routes for package
include(__DIR__.'/Http/routes.php');
// Load the package routes
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');

// Load migrations, views, translations only if necessary
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
$this->loadViewsFrom(__DIR__ . '/../views', 'sGallery');
$this->loadTranslationsFrom(__DIR__.'/../lang', 'sGallery');
$this->loadMigrationsFrom(dirname(__DIR__) . '/database/migrations');
$this->loadViewsFrom(dirname(__DIR__) . '/views', 'sGallery');
$this->loadTranslationsFrom(dirname(__DIR__) . '/lang', 'sGallery');

// Publish configuration and assets
$this->publishResources();
Expand All @@ -30,9 +30,7 @@ public function boot()
$this->mergeConfigFrom(dirname(__DIR__) . '/config/sGalleryCheck.php', 'cms.settings');

// Register sGallery as a singleton using the key 'sGallery'
$this->app->singleton('sGallery', function ($app) {
return new \Seiger\sGallery\sGallery();
});
$this->app->singleton('sGallery', fn($app) => new \Seiger\sGallery\sGallery());

// Create class alias for the facade
class_alias(\Seiger\sGallery\Facades\sGallery::class, 'sGallery');
Expand All @@ -45,10 +43,8 @@ class_alias(\Seiger\sGallery\Facades\sGallery::class, 'sGallery');
*/
public function register()
{
//this code work for add plugins to Evo
$this->loadPluginsFrom(
dirname(__DIR__) . '/plugins/'
);
// Add plugins to Evolution CMS
$this->loadPluginsFrom(dirname(__DIR__) . '/plugins/');
}

/**
Expand Down

0 comments on commit 3d1b90d

Please sign in to comment.