feat(wallets): implement wallet and transaction management with associated models, policies, and resources
This commit is contained in:
67
app/Filament/Resources/Wallets/WalletResource.php
Normal file
67
app/Filament/Resources/Wallets/WalletResource.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Wallets;
|
||||
|
||||
use App\Filament\Resources\Wallets\Pages\EditWallet;
|
||||
use App\Filament\Resources\Wallets\Pages\ListWallets;
|
||||
use App\Filament\Resources\Wallets\Pages\ViewWallet;
|
||||
use App\Filament\Resources\Wallets\RelationManagers\TransactionsRelationManager;
|
||||
use App\Filament\Resources\Wallets\Schemas\WalletForm;
|
||||
use App\Filament\Resources\Wallets\Tables\WalletsTable;
|
||||
use App\Models\Wallet;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class WalletResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Wallet::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedWallet;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'مالی';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'id';
|
||||
|
||||
protected static ?string $modelLabel = 'کیف پول';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'کیف پولها';
|
||||
|
||||
protected static ?string $navigationLabel = 'کیف پولها';
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return WalletForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return WalletsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
TransactionsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListWallets::route('/'),
|
||||
'view' => ViewWallet::route('/{record}'),
|
||||
'edit' => EditWallet::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user