This commit is contained in:
Bozhidar 2024-04-25 17:12:03 +03:00
parent 8cb3f8e7c9
commit 72c3c03582
3 changed files with 101 additions and 1 deletions

View file

@ -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'),
];
}
}

View file

@ -0,0 +1,94 @@
<?php
namespace app\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Filament\Resources\Blog\PostResource;
use App\Filament\Resources\HostingSubscriptionResource;
use App\Models\DatabaseUser;
use App\Models\RemoteDatabaseServer;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Infolists\Components\IconEntry;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
use Filament\Resources\Pages\ManageRelatedRecords;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Contracts\Support\Htmlable;
class ManageHostingSubscriptionBackups extends ManageRelatedRecords
{
protected static string $resource = HostingSubscriptionResource::class;
protected static string $relationship = 'backups';
protected static ?string $navigationIcon = 'heroicon-o-circle-stack';
public function getTitle(): string | Htmlable
{
$recordTitle = $this->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(),
]);
}
}

View file

@ -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();