From 72c3c035826250f6c431c7a1f85440eecd93ef96 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 25 Apr 2024 17:12:03 +0300 Subject: [PATCH] update --- .../Resources/HostingSubscriptionResource.php | 3 +- .../ManageHostingSubscriptionBackups.php | 94 +++++++++++++++++++ web/app/Models/HostingSubscription.php | 5 + 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 web/app/Filament/Resources/HostingSubscriptionResource/Pages/ManageHostingSubscriptionBackups.php diff --git a/web/app/Filament/Resources/HostingSubscriptionResource.php b/web/app/Filament/Resources/HostingSubscriptionResource.php index fac6412..10710e8 100644 --- a/web/app/Filament/Resources/HostingSubscriptionResource.php +++ b/web/app/Filament/Resources/HostingSubscriptionResource.php @@ -171,6 +171,7 @@ class HostingSubscriptionResource extends Resource // Pages\ViewHos::class, Pages\EditHostingSubscription::class, Pages\ManageHostingSubscriptionDatabases::class, + Pages\ManageHostingSubscriptionBackups::class, ]); } @@ -188,8 +189,8 @@ class HostingSubscriptionResource extends Resource 'index' => Pages\ListHostingSubscriptions::route('/'), 'create' => Pages\CreateHostingSubscription::route('/create'), 'edit' => Pages\EditHostingSubscription::route('/{record}/edit'), - 'databases' => Pages\ManageHostingSubscriptionDatabases::route('/{record}/databases'), + 'backups' => Pages\ManageHostingSubscriptionBackups::route('/{record}/backups'), ]; } } diff --git a/web/app/Filament/Resources/HostingSubscriptionResource/Pages/ManageHostingSubscriptionBackups.php b/web/app/Filament/Resources/HostingSubscriptionResource/Pages/ManageHostingSubscriptionBackups.php new file mode 100644 index 0000000..ccc6d99 --- /dev/null +++ b/web/app/Filament/Resources/HostingSubscriptionResource/Pages/ManageHostingSubscriptionBackups.php @@ -0,0 +1,94 @@ +getRecordTitle(); + + $recordTitle = $recordTitle instanceof Htmlable ? $recordTitle->toHtml() : $recordTitle; + + return "Manage {$recordTitle} Backups"; + } + + public function getBreadcrumb(): string + { + return 'Backups'; + } + + public static function getNavigationLabel(): string + { + return 'Manage Backups'; + } + + public function form(Form $form): Form + { + + return $form + ->schema([ + + + + ]) + ->columns(1); + } + + public function infolist(Infolist $infolist): Infolist + { + return $infolist + ->columns(1) + ->schema([ + TextEntry::make('id')->label('id'), + ]); + } + + public function table(Table $table): Table + { + + return $table + ->recordTitleAttribute('id') + ->columns([ + + + + ]) + ->filters([ + // + ]) + ->headerActions([ + Tables\Actions\CreateAction::make(), +// + ]) + ->actions([ + // Tables\Actions\ViewAction::make(), + Tables\Actions\EditAction::make(), + Tables\Actions\DeleteAction::make(), + ]) + ->groupedBulkActions([ + Tables\Actions\DeleteBulkAction::make(), + ]); + } +} diff --git a/web/app/Models/HostingSubscription.php b/web/app/Models/HostingSubscription.php index b1274c3..e5c0b01 100644 --- a/web/app/Models/HostingSubscription.php +++ b/web/app/Models/HostingSubscription.php @@ -85,6 +85,11 @@ class HostingSubscription extends Model return $this->hasMany(Database::class); } + public function backups() + { + return $this->hasMany(HostingSubscriptionBackup::class); + } + private function _createLinuxWebUser($model): array { $findCustomer = Customer::where('id', $model->customer_id)->first();