Skip to content

Commit

Permalink
structure
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Apr 11, 2019
1 parent 9abc740 commit 54dc4ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Config/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'bs3-navmenu' => \Akaunting\Menu\Presenters\Bootstrap3\Nav::class,

// Zurb
'zurbmenu' => \Akaunting\Menu\Presenters\Foundation\Zurb::class,
'zurb' => \Akaunting\Menu\Presenters\Foundation\Zurb::class,

// Admin
'adminlte' => \Akaunting\Menu\Presenters\Admin\Adminlte::class,
Expand Down
49 changes: 17 additions & 32 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,41 @@
class Provider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
* Bootstrap the application services.
*
* @var bool
*/
protected $defer = true;

/**
* Bootstrap the application events.
* @return void
*/
public function boot()
{
$configPath = __DIR__ . '/Config/menu.php';
$viewsPath = __DIR__ . '/Resources/views';

$this->mergeConfigFrom($configPath, 'menu');
$this->loadViewsFrom($viewsPath, 'menu');

$this->publishes([
$configPath => config_path('menu.php'),
__DIR__ . '/Config/menu.php' => config_path('menu.php'),
], 'menu');

$this->publishes([
$viewsPath => base_path('resources/views/vendor/akaunting/menu'),
__DIR__ . '/Resources/views' => base_path('resources/views/vendor/akaunting/menu'),
], 'views');

if (file_exists($file = app_path('Support/menu.php'))) {
require $file;

$this->app->singleton('menu', function ($app) {
return new Menu($app['view'], $app['config']);
});

if (file_exists($file = app_path('Support/menus.php'))) {
require_once($file);
}
}

/**
* Register the service provider.
* Register the application services.
*
* @return void
*/
public function register()
{
$this->registerHtmlPackage();

$this->app->singleton('menu', function ($app) {
return new Menu($app['view'], $app['config']);
});
$this->mergeConfigFrom(__DIR__ . '/Config/menu.php', 'menu');

$this->loadViewsFrom(__DIR__ . '/Resources/views', 'menu');
}

/**
Expand All @@ -64,14 +59,4 @@ private function registerHtmlPackage()

AliasLoader::getInstance($aliases)->register();
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['menu'];
}
}

0 comments on commit 54dc4ea

Please sign in to comment.