File tree Expand file tree Collapse file tree
billing/src/Console/Commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Boy132 \Billing \Console \Commands ;
44
5+ use Boy132 \Billing \Enums \OrderStatus ;
6+ use Boy132 \Billing \Filament \App \Resources \Orders \Pages \ListOrders ;
57use Boy132 \Billing \Models \Order ;
8+ use Filament \Actions \Action ;
9+ use Filament \Notifications \Notification ;
610use Illuminate \Console \Command ;
711
812class CheckOrdersCommand extends Command
@@ -25,7 +29,26 @@ public function handle(): int
2529 foreach ($ orders as $ order ) {
2630 $ bar ->clear ();
2731
28- $ order ->checkExpire ();
32+ if ($ order ->checkExpire ()) {
33+ Notification::make ()
34+ ->success ()
35+ ->title ('Order expired ' )
36+ ->body ($ order ->getLabel ())
37+ ->actions ([
38+ Action::make ('goto_orders ' )
39+ ->label ('Go to orders ' )
40+ ->markAsRead ()
41+ ->url (ListOrders::getUrl (panel: 'app ' )),
42+ Action::make ('renew ' )
43+ ->visible (fn (Order $ order ) => $ order ->status === OrderStatus::Expired && $ order ->productPrice ->renewable )
44+ ->label ('Renew ' )
45+ ->color ('warning ' )
46+ ->requiresConfirmation ()
47+ ->markAsRead ()
48+ ->action (fn (Order $ order ) => redirect ($ order ->getCheckoutSession ()->url )),
49+ ])
50+ ->sendToDatabase ($ order ->customer ->user );
51+ }
2952
3053 $ bar ->advance ();
3154 $ bar ->display ();
You can’t perform that action at this time.
0 commit comments