File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33namespace Leaf \Queue \Commands ;
44
55use Aloe \Command ;
6+ use Illuminate \Support \Str ;
67
78class DeleteJobCommand extends Command
89{
@@ -12,13 +13,27 @@ class DeleteJobCommand extends Command
1213
1314 protected function config ()
1415 {
15- $ this ->setArgument ('job ' , 'required ' );
16+ $ this ->setArgument ('job ' , 'required ' , ' job name ' );
1617 }
1718
1819 protected function handle ()
1920 {
20- $ job = $ this ->argument ('config ' );
21+ $ job = Str:: studly (Str:: singular ( $ this ->argument ('job ' )) );
2122
22- $ this ->writeln ("Deleting job $ job " );
23+ if (!strpos ($ job , 'Job ' )) {
24+ $ job .= 'Job ' ;
25+ }
26+
27+ $ file = \Aloe \Command \Config::rootpath (AppPaths ('jobs ' ) . "/ $ job.php " );
28+
29+ if (!file_exists ($ file )) {
30+ $ this ->error ("$ job doesn't exist " );
31+ return 1 ;
32+ }
33+
34+ unlink ($ file );
35+
36+ $ this ->comment ("$ job deleted successfully " );
37+ return 0 ;
2338 }
2439}
You can’t perform that action at this time.
0 commit comments