Skip to content

Commit

Permalink
Add isSingleton to capsule class.
Browse files Browse the repository at this point in the history
  • Loading branch information
haringsrob committed Feb 18, 2022
1 parent facb524 commit 88536ce
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/Helpers/Capsule.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace A17\Twill\Helpers;

use A17\Twill\Facades\TwillRoutes;
use A17\Twill\Http\Controllers\Admin\SingletonModuleController;
use Illuminate\Contracts\Translation\Translator;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Support\Facades\App;
Expand Down Expand Up @@ -330,14 +331,26 @@ public function registerConfig(): void
{
$config = Config::get('twill-navigation', []);

$config[lcfirst($this->getSingular())] = [
'title' => $this->name,
'singleton' => true,
];
if ($this->isSingleton()) {
$config[lcfirst($this->getSingular())] = [
'title' => $this->name,
'singleton' => true,
];
}
else {
$config[$this->name] = [
'title' => $this->name,
'module' => true,
];
}

Config::set('twill-navigation', $config);
}

public function isSingleton(): bool {
return is_subclass_of($this->getControllerClass(), SingletonModuleController::class);
}

public function getType(): string {
return '';
}
Expand Down

0 comments on commit 88536ce

Please sign in to comment.