components(static::getForm()); } public static function getForm(): array { return [ Select::make('user_id') ->label(__('User')) ->relationship('user', 'username') ->required(), TextInput::make('transaction_id') ->label(__('Transaction ID')) ->required() ->maxLength(255), TextInput::make('status') ->label(__('Status')) ->required() ->maxLength(255), TextInput::make('description') ->label(__('Description')) ->maxLength(512), TextInput::make('amount') ->label(__('Amount')) ->numeric() ->required(), TextInput::make('currency') ->label(__('Currency')) ->maxLength(255) ->default('USD'), ]; } #[\Override] public static function table(Table $table): Table { return $table ->columns(static::getTable()); } public static function getTable(): array { return [ TextColumn::make('id') ->label(__('ID')) ->sortable(), TextColumn::make('user.username') ->label(__('User')) ->searchable(), TextColumn::make('transaction_id') ->label(__('Transaction ID')) ->searchable() ->limit(20), TextColumn::make('status') ->label(__('Status')) ->badge() ->color(fn (string $state): string => match ($state) { 'completed' => 'success', 'pending' => 'warning', 'failed' => 'danger', default => 'gray', }), TextColumn::make('description') ->label(__('Description')) ->limit(50), TextColumn::make('amount') ->label(__('Amount')) ->money(fn (WebsitePaypalTransaction $record): string => $record->currency), TextColumn::make('currency') ->label(__('Currency')), TextColumn::make('created_at') ->label(__('Created')) ->dateTime(), ]; } #[\Override] public static function getPages(): array { return [ 'index' => ListPayPalTransactions::route('/'), ]; } }