User management resource with editable is_admin field, postcode support, admin filter, and inline delete action. Includes list and edit pages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\NavigationGroup;
|
|
use App\Filament\Resources\BrentPriceResource\Pages\ListBrentPrices;
|
|
use App\Models\BrentPrice;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class BrentPriceResource extends Resource
|
|
{
|
|
protected static ?string $model = BrentPrice::class;
|
|
|
|
protected static string|\UnitEnum|null $navigationGroup = NavigationGroup::Data;
|
|
|
|
protected static ?string $navigationLabel = 'Brent Prices';
|
|
|
|
protected static ?int $navigationSort = 2;
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('date')
|
|
->date('d M Y')
|
|
->sortable(),
|
|
TextColumn::make('price_usd')
|
|
->label('Price (USD/barrel)')
|
|
->numeric(2)
|
|
->sortable(),
|
|
])
|
|
->defaultSort('date', 'desc')
|
|
->recordActions([])
|
|
->filters([]);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListBrentPrices::route('/'),
|
|
];
|
|
}
|
|
}
|