class AgreementsRelationManager extends RelationManager
{
protected static string $relationship = 'agreements';
protected static ?string $recordTitleAttribute = 'name';
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('starts_at')->date(),
Tables\Columns\TextColumn::make('ends_at')->date(),
Tables\Columns\TextColumn::make('billing_type')
->badge()
->color(fn (string $state): string => match ($state) {
'fixedfee' => 'gray',
'payg' => 'warning',
'subscription' => 'success',
'prepaid' => 'danger',
}),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
}
class AgreementsRelationManager extends RelationManager
{
protected static string $relationship = 'agreements';
protected static ?string $recordTitleAttribute = 'name';
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('starts_at')->date(),
Tables\Columns\TextColumn::make('ends_at')->date(),
Tables\Columns\TextColumn::make('billing_type')
->badge()
->color(fn (string $state): string => match ($state) {
'fixedfee' => 'gray',
'payg' => 'warning',
'subscription' => 'success',
'prepaid' => 'danger',
}),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
}