File tree Expand file tree Collapse file tree 4 files changed +86
-0
lines changed Expand file tree Collapse file tree 4 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 1313 " generator" ,
1414 " cli" ,
1515 " artisan" ,
16+ " action" ,
1617 " pivot" ,
1718 " migrations"
1819 " services" ,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace RajTechnologies \Tools \Console ;
4+
5+ use Illuminate \Console \GeneratorCommand ;
6+
7+ class MakeAction extends GeneratorCommand
8+ {
9+ /**
10+ * The name and signature of the console command.
11+ *
12+ * @var string
13+ */
14+ protected $ signature = 'make:action {name} ' ;
15+
16+ /**
17+ * The console command description.
18+ *
19+ * @var string
20+ */
21+ protected $ description = 'Create a new action class ' ;
22+
23+ /**
24+ * The type of class being generated.
25+ *
26+ * @var string
27+ */
28+ protected $ type = 'Action ' ;
29+
30+ /**
31+ * Get the stub file for the generator.
32+ *
33+ * @return string
34+ */
35+ protected function getStub ()
36+ {
37+ return __DIR__ .'/../../stubs/action.stub ' ;
38+ }
39+
40+ /**
41+ * Get the default namespace for the class.
42+ *
43+ * @param string $rootNamespace
44+ * @return string
45+ */
46+ protected function getDefaultNamespace ($ rootNamespace )
47+ {
48+ return $ rootNamespace .'\Actions ' ;
49+ }
50+ }
Original file line number Diff line number Diff line change 77use Illuminate \Support \Facades \File ;
88use RajTechnologies \Tools \Console \MakeRepository ;
99use RajTechnologies \Tools \Console \MakeRepositoryInterface ;
10+ use RajTechnologies \Tools \Console \MakeAction ;
1011use RajTechnologies \Tools \Console \MakePivotCommand ;
1112use RajTechnologies \Tools \Console \MakeModel ;
1213use RajTechnologies \Tools \Console \MakeService ;
@@ -31,6 +32,11 @@ public function boot(){
3132 ], 'config ' );
3233 }
3334 // Repository Pattern End
35+ // Action Start
36+ if ($ this ->app ->runningInConsole ()) {
37+ $ this ->commands ([MakeAction::class]);
38+ }
39+ // Action End
3440 // Pivot Table Start
3541 if ($ this ->app ->runningInConsole ()) {
3642 $ this ->commands ([MakePivotCommand::class]);
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace {{ namespace }};
4+
5+ /**
6+ * Class DummyClass.
7+ */
8+ class DummyClass
9+ {
10+ /**
11+ * Create a new action instance.
12+ *
13+ * @return void
14+ */
15+ public function __construct()
16+ {
17+ // Prepare the action for execution, leveraging constructor injection.
18+ }
19+
20+ /**
21+ * Execute the action.
22+ *
23+ * @return mixed
24+ */
25+ public function execute()
26+ {
27+ // business logic
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments