implement admin panel
This commit is contained in:
92 files changed
+5426
-9
No files matched your search
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Loans;
|
||||
|
||||
use App\Filament\Resources\Loans\Pages\ListLoans;
|
||||
use App\Filament\Resources\Loans\Pages\ViewLoan;
|
||||
use App\Filament\Resources\Loans\RelationManagers\HistoriesRelationManager;
|
||||
use App\Filament\Resources\Loans\Schemas\LoanInfolist;
|
||||
use App\Filament\Resources\Loans\Tables\LoansTable;
|
||||
use App\Models\Loan;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use UnitEnum;
|
||||
|
||||
class LoanResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Loan::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentText;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Operations';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'public_id';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return LoanInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LoansTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
HistoriesRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListLoans::route('/'),
|
||||
'view' => ViewLoan::route('/{record}'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withCount('histories')
|
||||
->with([
|
||||
'loanType:id,name,code',
|
||||
'workflowConfiguration:id,name,version',
|
||||
'currentStep.stageDefinition:id,name,code',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user