- Add unified payment provider architecture with contract-based design - Implement 6 payment providers: Stripe, Lemon Squeezy, Polar, Oxapay, Crypto, Activation Keys - Create subscription management with lifecycle handling (create, cancel, pause, resume, update) - Add coupon system with usage tracking and trial extensions - Build Filament admin resources for payment providers, subscriptions, coupons, and trials - Implement payment orchestration service with provider registry and configuration management - Add comprehensive payment logging and webhook handling for all providers - Create customer analytics dashboard with revenue, churn, and lifetime value metrics - Add subscription migration service for provider switching - Include extensive test coverage for all payment functionality
112 lines
3.7 KiB
PHP
112 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\TrialExtensions\Tables;
|
|
|
|
use Filament\Actions\Action;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Filters\SelectFilter;
|
|
use Filament\Tables\Table;
|
|
|
|
class TrialExtensionsTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('user.name')
|
|
->label('User')
|
|
->searchable()
|
|
->sortable()
|
|
->limit(30),
|
|
|
|
TextColumn::make('subscription.plan.name')
|
|
->label('Plan')
|
|
->searchable()
|
|
->sortable(),
|
|
|
|
TextColumn::make('extension_days')
|
|
->label('Days Extended')
|
|
->sortable()
|
|
->alignCenter()
|
|
->badge()
|
|
->color('success'),
|
|
|
|
TextColumn::make('extension_type')
|
|
->badge()
|
|
->label('Type')
|
|
->colors([
|
|
'blue' => 'manual',
|
|
'green' => 'automatic',
|
|
'orange' => 'compensation',
|
|
]),
|
|
|
|
TextColumn::make('original_trial_ends_at')
|
|
->label('Original End')
|
|
->dateTime('M j, Y')
|
|
->sortable()
|
|
->toggleable(),
|
|
|
|
TextColumn::make('new_trial_ends_at')
|
|
->label('New End')
|
|
->dateTime('M j, Y')
|
|
->sortable()
|
|
->color('success')
|
|
->description(fn ($record): string => $record->new_trial_ends_at->diffForHumans()
|
|
),
|
|
|
|
TextColumn::make('reason')
|
|
->label('Reason')
|
|
->limit(30)
|
|
->toggleable(),
|
|
|
|
TextColumn::make('grantedByAdmin.name')
|
|
->label('Granted By')
|
|
->searchable()
|
|
->sortable()
|
|
->toggleable(),
|
|
|
|
TextColumn::make('granted_at')
|
|
->label('Granted At')
|
|
->dateTime('M j, Y')
|
|
->sortable(),
|
|
])
|
|
->filters([
|
|
SelectFilter::make('extension_type')
|
|
->label('Extension Type')
|
|
->options([
|
|
'manual' => 'Manual Grant',
|
|
'automatic' => 'Automatic Extension',
|
|
'compensation' => 'Compensation',
|
|
]),
|
|
|
|
SelectFilter::make('granted_by_admin_id')
|
|
->label('Granted By')
|
|
->relationship('grantedByAdmin', 'name')
|
|
->searchable()
|
|
->preload(),
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
|
|
Action::make('view_subscription')
|
|
->label('View Subscription')
|
|
->icon('heroicon-o-rectangle-stack')
|
|
->color('blue')
|
|
->url(fn ($record) => route('filament.' . filament()->getCurrentPanel()->getId() . '.resources.subscriptions.edit', $record->subscription_id))
|
|
->openUrlInNewTab(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
])
|
|
->emptyStateActions([
|
|
CreateAction::make(),
|
|
]);
|
|
}
|
|
}
|