File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 33namespace Binarcode \LaravelMailator ;
44
55use Binarcode \LaravelMailator \Models \MailatorSchedule ;
6+ use Binarcode \LaravelMailator \Support \ClassResolver ;
67
78class SchedulerManager
89{
10+ use ClassResolver;
11+
912 private ?MailatorSchedule $ instance ;
1013
1114 public function init (string $ name ): MailatorSchedule
1215 {
13- return $ this ->instance = MailatorSchedule ::init ($ name );
16+ return $ this ->instance = ( static :: scheduler ()) ::init ($ name );
1417 }
1518
1619 public function __destruct ()
1720 {
18- if (! $ this ->instance ->wasRecentlyCreated ) {
21+ if (!$ this ->instance ->wasRecentlyCreated ) {
1922 $ this ->instance ->save ();
2023 }
2124 }
Original file line number Diff line number Diff line change 33namespace Binarcode \LaravelMailator \Support ;
44
55use Binarcode \LaravelMailator \Actions \ResolveGarbageAction ;
6+ use Binarcode \LaravelMailator \Models \MailatorSchedule ;
67
78trait ClassResolver
89{
@@ -12,4 +13,11 @@ public static function garbageResolver(): ResolveGarbageAction
1213 config ('mailator.scheduler.garbage_resolver ' , ResolveGarbageAction::class),
1314 );
1415 }
16+
17+ public static function scheduler (): MailatorSchedule
18+ {
19+ return app (
20+ config ('mailator.scheduler.model ' , MailatorSchedule::class),
21+ );
22+ }
1523}
You can’t perform that action at this time.
0 commit comments