File tree Expand file tree Collapse file tree
billing/src/Filament/App/Widgets Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66use Boy132 \Billing \Models \Customer ;
77use Boy132 \Billing \Models \Order ;
88use Boy132 \Billing \Models \Product ;
9+ use Boy132 \Billing \Models \ProductPrice ;
910use Filament \Actions \Action ;
1011use Filament \Actions \Concerns \InteractsWithActions ;
1112use Filament \Actions \Contracts \HasActions ;
1617use Filament \Schemas \Contracts \HasSchemas ;
1718use Filament \Schemas \Schema ;
1819use Filament \Widgets \Widget ;
20+ use Illuminate \Database \Eloquent \Collection ;
1921use Illuminate \Support \Number ;
2022
2123class ProductWidget extends Widget implements HasActions, HasSchemas
@@ -31,7 +33,10 @@ public function content(Schema $schema): Schema
3133 {
3234 $ actions = [];
3335
34- foreach ($ this ->product ->prices as $ price ) {
36+ /** @var Collection<int, ProductPrice> $prices */
37+ $ prices = $ this ->product ->prices ()->orderBy ('cost ' )->get ();
38+
39+ foreach ($ prices as $ price ) {
3540 $ actions [] = Action::make ('exclude_ ' . str_slug ($ price ->name ))
3641 ->label ($ price ->getLabel ())
3742 ->action (function () use ($ price ) {
You can’t perform that action at this time.
0 commit comments