Files
daragt-coupon/app/Filament/Resources/Coupons/Tables/CouponsTable.php

50 lines
1.6 KiB
PHP

<?php
namespace App\Filament\Resources\Coupons\Tables;
use App\Filament\Tables\Filters\CreatedAtDateFilter;
use Filament\Actions\DeleteAction;
use Filament\Actions\ViewAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class CouponsTable
{
public static function configure(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->columns([
TextColumn::make('id')
->label(__('filament.fields.id'))
->sortable(),
TextColumn::make('phone')
->label(__('filament.fields.phone'))
->formatStateUsing(fn (string $state): string => format_phone($state))
->searchable()
->sortable()
->copyable(),
TextColumn::make('code')
->label(__('filament.fields.code'))
->sortable()
->copyable(),
TextColumn::make('created_at')
->label(__('filament.fields.created_at'))
->dateTime()
->sortable(),
TextColumn::make('updated_at')
->label(__('filament.fields.updated_at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
CreatedAtDateFilter::make(),
])
->recordActions([
ViewAction::make(),
DeleteAction::make(),
]);
}
}