feat: add BrentPriceResource with 30-day line chart widget
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
46
app/Filament/Resources/BrentPriceResource.php
Normal file
46
app/Filament/Resources/BrentPriceResource.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
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|\BackedEnum|null $navigationIcon = 'heroicon-o-currency-dollar';
|
||||
|
||||
protected static string|\UnitEnum|null $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('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user