Files
Ovidiu U aec547cd86
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
refactor: restructure Stripe pricing config to support monthly and annual tiers
- Nest price IDs under `monthly` and `annual` keys for each tier (basic, plus, pro)
2026-04-14 19:26:01 +01:00

51 lines
1.6 KiB
PHP

<?php
namespace App\Filament\Resources\BrentPriceResource\Pages;
use App\Filament\Resources\BrentPriceResource;
use App\Filament\Widgets\BrentPriceChartWidget;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Support\Facades\Artisan;
class ListBrentPrices extends ListRecords
{
protected static string $resource = BrentPriceResource::class;
protected function getHeaderActions(): array
{
return [
Action::make('fetchPrices')
->label('Fetch Prices Now')
->icon('heroicon-o-arrow-down-tray')
->requiresConfirmation()
->modalHeading('Fetch latest Brent prices?')
->modalDescription('Pulls the latest Brent crude prices from EIA (falls back to FRED if EIA is unavailable).')
->action(function () {
$result = Artisan::call('oil:fetch');
if ($result === 0) {
Notification::make()
->title('Brent prices fetched successfully')
->success()
->send();
} else {
Notification::make()
->title('Fetch failed')
->body('Both EIA and FRED failed. Check API Logs for details.')
->danger()
->send();
}
}),
];
}
protected function getHeaderWidgets(): array
{
return [
BrentPriceChartWidget::class,
];
}
}