Skip to content

Commit

Permalink
add filament-plugins integration
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Sep 16, 2024
1 parent be6c8a8 commit 52df4cd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
29 changes: 29 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "FilamentMenus",
"alias": "filament-menus",
"description": {
"ar": "قم ببناء قائمتك باستخدام قاعدة البيانات",
"en": "Menu Database builder to use it as a navigation on Filament Panel or as a Livewire Component",
"gr": "Menu Database builder to use it as a navigation on Filament Panel or as a Livewire Component",
"sp": "Menu Database builder to use it as a navigation on Filament Panel or as a Livewire Component"
},
"keywords": [],
"priority": 0,
"providers": [
"TomatoPHP\\FilamentMenus\\FilamentMenusServiceProvider"
],
"files": [],
"title": {
"ar": "القوائم",
"en": "Menu Generator",
"gr": "Menu Generator",
"sp": "Menu Generator"
},
"color": "#17b8d1",
"icon": "heroicon-c-bars-3",
"placeholder": "placeholder.webp",
"type": "plugin",
"version": "v1.0.6",
"github" : "https://github.com/tomatophp/filament-menus",
"docs" : "https://github.com/tomatophp/filament-menus"
}
22 changes: 18 additions & 4 deletions src/FilamentMenusPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,37 @@
use Filament\Contracts\Plugin;
use Filament\Panel;
use Illuminate\View\View;
use Nwidart\Modules\Module;
use TomatoPHP\FilamentMenus\Resources\MenuResource;
use TomatoPHP\FilamentTranslations\Http\Middleware\LanguageMiddleware;
use TomatoPHP\FilamentTranslations\Resources\TranslationResource;

class FilamentMenusPlugin implements Plugin
{
private bool $isActive = false;

public function getId(): string
{
return 'filament-menus';
}

public function register(Panel $panel): void
{
$panel
->resources([
MenuResource::class
]);
if(class_exists(Module::class)){
if(\Nwidart\Modules\Facades\Module::find('FilamentMenus')->isEnabled()){
$this->isActive = true;
}
}
else {
$this->isActive = true;
}

if($this->isActive) {
$panel
->resources([
MenuResource::class
]);
}
}

public function boot(Panel $panel): void
Expand Down

0 comments on commit 52df4cd

Please sign in to comment.