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 2b9205b commit 42b2f8d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
29 changes: 29 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
@@ -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"
}
28 changes: 21 additions & 7 deletions src/FilamentPaymentsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,40 @@

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';
}

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
Expand Down

0 comments on commit 42b2f8d

Please sign in to comment.