The features JSON column required defensive fallback stubs in three places (Plan::resolveForUser, PlanFeatures::__construct, PlanSeeder) and silently swallowed misspelled keys. Typed columns give Eloquent type-safe reads, simplify the Filament form (no more dotted JSON paths), and let resolveForUser fail loud when the free row is missing. PlanFeatures public API is unchanged so consumers (jobs, middleware) need no rewrites — one missed JSON read in SendScheduledWhatsAppJob was caught and converted to a typed where() query. tests/Pest.php seeds PlanSeeder in beforeEach so any feature test that resolves a plan finds the free row, mirroring production where plans always exist. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Plans\Tables;
|
|
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class PlansTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('name')
|
|
->label('Tier')
|
|
->badge()
|
|
->sortable(),
|
|
TextColumn::make('email_frequency')
|
|
->label('Email')
|
|
->placeholder('—'),
|
|
TextColumn::make('sms_daily_limit')
|
|
->label('SMS/day')
|
|
->placeholder('—'),
|
|
TextColumn::make('whatsapp_daily_limit')
|
|
->label('WhatsApp/day')
|
|
->placeholder('—'),
|
|
TextColumn::make('max_fuel_types')
|
|
->label('Fuel types')
|
|
->placeholder('Unlimited'),
|
|
IconColumn::make('active')
|
|
->boolean(),
|
|
])
|
|
->defaultSort('id', 'asc')
|
|
->recordActions([
|
|
EditAction::make(),
|
|
]);
|
|
}
|
|
}
|