File tree Expand file tree Collapse file tree 4 files changed +90
-3
lines changed Expand file tree Collapse file tree 4 files changed +90
-3
lines changed Original file line number Diff line number Diff line change 1212 " php" ,
1313 " generator" ,
1414 " cli" ,
15- " artisan"
15+ " artisan" ,
16+ " action" ,
17+ " pattern"
1618 ],
1719 "license" : " MIT" ,
1820 "authors" : [
3537 ]
3638 }
3739 }
38- }
40+ }
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 ;
1011
1112class ToolServiceProvider extends ServiceProvider
1213{
@@ -28,6 +29,11 @@ public function boot(){
2829 ], 'config ' );
2930 }
3031 // Repository Pattern End
32+ // Action Start
33+ if ($ this ->app ->runningInConsole ()) {
34+ $ this ->commands ([MakeAction::class]);
35+ }
36+ // Action End
3137 }
3238
3339 public function register (){
@@ -62,4 +68,4 @@ protected function bindInterfaces()
6268 // Repository Pattern End
6369}
6470
65- ?>
71+ ?>
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