<?php
namespace App\Filament\Manager\Resources;
use App\Enum\TransactionClassification;
use App\Filament\Manager\Resources\BeneficiaryTransactionResource\Pages;
use App\Filament\Manager\Resources\BeneficiaryTransactionResource\RelationManagers;
use App\Filament\SharedForm\TransactionForm;
use App\Models\BeneficiaryTransaction;
use App\Models\Transaction;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Facades\URL;
class BeneficiaryTransactionResource extends Resource
{
protected static ?string $model = Transaction::class;
#[URL]
public ?string $record;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}
public static function shouldRegisterNavigation(): bool
{
return false;
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->columns(TransactionForm::tableBeneficiarySchema())
->persistFiltersInSession()
->persistSortInSession();
}
protected function getTableQuery(): Builder
{
return parent::getTableQuery()
->where('user_id', $this->record);
}
public static function getPages(): array
{
return [
'index' => Pages\ManageBeneficiaryTransactions::route('/'),
];
}
}