75 lines
2.3 KiB
PHP
75 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Groups\RelationManagers;
|
|
|
|
use Filament\Actions\AssociateAction;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\DissociateAction;
|
|
use Filament\Actions\DissociateBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Forms\Components\DatePicker;
|
|
use Filament\Forms\Components\FileUpload;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class PilgrimsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'pilgrims';
|
|
|
|
public function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->columns(2)
|
|
->components([
|
|
TextInput::make('first_name')
|
|
->required()
|
|
->maxLength(255),
|
|
TextInput::make('last_name')
|
|
->required()
|
|
->maxLength(255),
|
|
DatePicker::make('birthdate')
|
|
->native(false)
|
|
->required(),
|
|
FileUpload::make('image')
|
|
->image(),
|
|
FileUpload::make('local_passport'),
|
|
FileUpload::make('international_passport'),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('last_name')
|
|
->columns([
|
|
TextColumn::make('first_name')->searchable(),
|
|
TextColumn::make('last_name')->searchable(),
|
|
TextColumn::make('birthdate')->date(),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->headerActions([
|
|
CreateAction::make(),
|
|
AssociateAction::make(),
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
DissociateAction::make(),
|
|
DeleteAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
BulkActionGroup::make([
|
|
DissociateBulkAction::make(),
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|