diff --git a/module.json b/module.json new file mode 100644 index 0000000..d3ef19c --- /dev/null +++ b/module.json @@ -0,0 +1,29 @@ +{ + "name": "FilamentPayments", + "alias": "filament-payments", + "description": { + "ar": "قم بإدارة مدفوعاتك داخل تطبيق FilamentPHP مع تكامل بوابة الدفع المتعددة", + "en": "Manage your payments inside FilamentPHP app with multi payment gateway integration", + "gr": "Manage your payments inside FilamentPHP app with multi payment gateway integration", + "sp": "Manage your payments inside FilamentPHP app with multi payment gateway integration" + }, + "keywords": [], + "priority": 0, + "providers": [ + "TomatoPHP\\FilamentPayments\\FilamentPaymentsServiceProvider" + ], + "files": [], + "title": { + "ar": "المدفوعات", + "en": "Payment Manager", + "gr": "Payment Manager", + "sp": "Payment Manager" + }, + "color": "#cc1448", + "icon": "heroicon-c-credit-card", + "placeholder": "https://raw.githubusercontent.com/tomatophp/filament-payments/master/arts/3x1io-tomato-payments.jpg", + "type": "plugin", + "version": "v1.0.9", + "github" : "https://github.com/tomatophp/filament-payments", + "docs" : "https://github.com/tomatophp/filament-payments" +} diff --git a/src/FilamentPaymentsPlugin.php b/src/FilamentPaymentsPlugin.php index 3aea36e..36226d8 100644 --- a/src/FilamentPaymentsPlugin.php +++ b/src/FilamentPaymentsPlugin.php @@ -4,12 +4,15 @@ use Filament\Contracts\Plugin; use Filament\Panel; +use Nwidart\Modules\Module; use TomatoPHP\FilamentPayments\Filament\Pages\PaymentGateway; use TomatoPHP\FilamentPayments\Filament\Resources\PaymentGatewayResource; use TomatoPHP\FilamentPayments\Filament\Resources\PaymentResource; class FilamentPaymentsPlugin implements Plugin { + private bool $isActive = false; + public function getId(): string { return 'filament-payments'; @@ -17,13 +20,24 @@ public function getId(): string public function register(Panel $panel): void { - $panel - ->pages([ - PaymentGateway::class - ]) - ->resources([ - PaymentResource::class - ]); + if(class_exists(Module::class)){ + if(\Nwidart\Modules\Facades\Module::find('FilamentPayments')->isEnabled()){ + $this->isActive = true; + } + } + else { + $this->isActive = true; + } + + if($this->isActive) { + $panel + ->pages([ + PaymentGateway::class + ]) + ->resources([ + PaymentResource::class + ]); + } } public function boot(Panel $panel): void