68 lines
1.8 KiB
PHP
68 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Resources\ResumeResource\RelationManagers;
|
|
|
|
use Filament\Forms\Components\DatePicker;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
final class AwardsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'awards';
|
|
|
|
public function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
TextInput::make('title')
|
|
->required(),
|
|
|
|
DatePicker::make('awarded_at')
|
|
->label('Awarded Date'),
|
|
|
|
TextInput::make('awarder')
|
|
->required(),
|
|
|
|
TextInput::make('summary')
|
|
->required(),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('title')
|
|
->columns([
|
|
TextColumn::make('title')
|
|
->searchable()
|
|
->sortable(),
|
|
|
|
TextColumn::make('awarded_at')
|
|
->label('Awarded Date')
|
|
->date(),
|
|
|
|
TextColumn::make('awarder'),
|
|
|
|
TextColumn::make('summary'),
|
|
])
|
|
->headerActions([
|
|
Tables\Actions\CreateAction::make(),
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
Tables\Actions\DeleteAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|