@@ 9-92 (lines=84) @@ | ||
6 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
7 | use Symfony\Component\Console\Input\InputArgument; |
|
8 | ||
9 | class JobMakeCommand extends GeneratorCommand |
|
10 | { |
|
11 | ||
12 | use ModuleCommandTrait; |
|
13 | ||
14 | /** |
|
15 | * The console command name. |
|
16 | * |
|
17 | * @var string |
|
18 | */ |
|
19 | protected $name = 'module:make-job'; |
|
20 | ||
21 | /** |
|
22 | * The console command description. |
|
23 | * |
|
24 | * @var string |
|
25 | */ |
|
26 | protected $description = 'Create a new job class for the specified module'; |
|
27 | ||
28 | protected $argumentName = 'name'; |
|
29 | ||
30 | ||
31 | /** |
|
32 | * @return string |
|
33 | */ |
|
34 | public function getDefaultNamespace() |
|
35 | { |
|
36 | return 'Jobs'; |
|
37 | } |
|
38 | ||
39 | ||
40 | /** |
|
41 | * Get the console command arguments. |
|
42 | * |
|
43 | * @return array |
|
44 | */ |
|
45 | protected function getArguments() |
|
46 | { |
|
47 | return [ |
|
48 | ['name', InputArgument::REQUIRED, 'The name of the job.'], |
|
49 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
50 | ]; |
|
51 | } |
|
52 | ||
53 | ||
54 | /** |
|
55 | * Get template contents. |
|
56 | * |
|
57 | * @return string |
|
58 | */ |
|
59 | protected function getTemplateContents() |
|
60 | { |
|
61 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
62 | ||
63 | return (new Stub('/job.stub', [ |
|
64 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
65 | 'CLASS' => $this->getClass(), |
|
66 | ]))->render(); |
|
67 | } |
|
68 | ||
69 | ||
70 | /** |
|
71 | * Get the destination file path. |
|
72 | * |
|
73 | * @return string |
|
74 | */ |
|
75 | protected function getDestinationFilePath() |
|
76 | { |
|
77 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
78 | ||
79 | $jobPath = $this->laravel['modules']->config('paths.generator.jobs'); |
|
80 | ||
81 | return $path.$jobPath.'/'.$this->getFileName().'.php'; |
|
82 | } |
|
83 | ||
84 | ||
85 | /** |
|
86 | * @return string |
|
87 | */ |
|
88 | private function getFileName() |
|
89 | { |
|
90 | return studly_case($this->argument('name')); |
|
91 | } |
|
92 | } |
|
93 |
@@ 9-92 (lines=84) @@ | ||
6 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
7 | use Symfony\Component\Console\Input\InputArgument; |
|
8 | ||
9 | class MailMakeCommand extends GeneratorCommand |
|
10 | { |
|
11 | ||
12 | use ModuleCommandTrait; |
|
13 | ||
14 | /** |
|
15 | * The console command name. |
|
16 | * |
|
17 | * @var string |
|
18 | */ |
|
19 | protected $name = 'module:make-mail'; |
|
20 | ||
21 | /** |
|
22 | * The console command description. |
|
23 | * |
|
24 | * @var string |
|
25 | */ |
|
26 | protected $description = 'Create a new email class for the specified module'; |
|
27 | ||
28 | protected $argumentName = 'name'; |
|
29 | ||
30 | ||
31 | /** |
|
32 | * @return string |
|
33 | */ |
|
34 | public function getDefaultNamespace() |
|
35 | { |
|
36 | return 'Emails'; |
|
37 | } |
|
38 | ||
39 | ||
40 | /** |
|
41 | * Get the console command arguments. |
|
42 | * |
|
43 | * @return array |
|
44 | */ |
|
45 | protected function getArguments() |
|
46 | { |
|
47 | return [ |
|
48 | ['name', InputArgument::REQUIRED, 'The name of the mailable.'], |
|
49 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
50 | ]; |
|
51 | } |
|
52 | ||
53 | ||
54 | /** |
|
55 | * Get template contents. |
|
56 | * |
|
57 | * @return string |
|
58 | */ |
|
59 | protected function getTemplateContents() |
|
60 | { |
|
61 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
62 | ||
63 | return (new Stub('/mail.stub', [ |
|
64 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
65 | 'CLASS' => $this->getClass(), |
|
66 | ]))->render(); |
|
67 | } |
|
68 | ||
69 | ||
70 | /** |
|
71 | * Get the destination file path. |
|
72 | * |
|
73 | * @return string |
|
74 | */ |
|
75 | protected function getDestinationFilePath() |
|
76 | { |
|
77 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
78 | ||
79 | $mailPath = $this->laravel['modules']->config('paths.generator.emails', 'Emails'); |
|
80 | ||
81 | return $path.$mailPath.'/'.$this->getFileName().'.php'; |
|
82 | } |
|
83 | ||
84 | ||
85 | /** |
|
86 | * @return string |
|
87 | */ |
|
88 | private function getFileName() |
|
89 | { |
|
90 | return studly_case($this->argument('name')); |
|
91 | } |
|
92 | } |
|
93 |
@@ 10-96 (lines=87) @@ | ||
7 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
8 | use Symfony\Component\Console\Input\InputArgument; |
|
9 | ||
10 | class MiddlewareMakeCommand extends GeneratorCommand |
|
11 | { |
|
12 | ||
13 | use ModuleCommandTrait; |
|
14 | ||
15 | /** |
|
16 | * The name of argument name. |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $argumentName = 'name'; |
|
21 | ||
22 | /** |
|
23 | * The console command name. |
|
24 | * |
|
25 | * @var string |
|
26 | */ |
|
27 | protected $name = 'module:make-middleware'; |
|
28 | ||
29 | /** |
|
30 | * The console command description. |
|
31 | * |
|
32 | * @var string |
|
33 | */ |
|
34 | protected $description = 'Create a new middleware class for the specified module.'; |
|
35 | ||
36 | ||
37 | /** |
|
38 | * Get default namespace. |
|
39 | * |
|
40 | * @return string |
|
41 | */ |
|
42 | public function getDefaultNamespace() |
|
43 | { |
|
44 | return 'Http\Middleware'; |
|
45 | } |
|
46 | ||
47 | ||
48 | /** |
|
49 | * Get the console command arguments. |
|
50 | * |
|
51 | * @return array |
|
52 | */ |
|
53 | protected function getArguments() |
|
54 | { |
|
55 | return [ |
|
56 | ['name', InputArgument::REQUIRED, 'The name of the command.'], |
|
57 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
58 | ]; |
|
59 | } |
|
60 | ||
61 | ||
62 | /** |
|
63 | * @return mixed |
|
64 | */ |
|
65 | protected function getTemplateContents() |
|
66 | { |
|
67 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
68 | ||
69 | return (new Stub('/middleware.stub', [ |
|
70 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
71 | 'CLASS' => $this->getClass(), |
|
72 | ]))->render(); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * @return mixed |
|
78 | */ |
|
79 | protected function getDestinationFilePath() |
|
80 | { |
|
81 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
82 | ||
83 | $seederPath = $this->laravel['modules']->config('paths.generator.filter'); |
|
84 | ||
85 | return $path.$seederPath.'/'.$this->getFileName().'.php'; |
|
86 | } |
|
87 | ||
88 | ||
89 | /** |
|
90 | * @return string |
|
91 | */ |
|
92 | private function getFileName() |
|
93 | { |
|
94 | return Str::studly($this->argument('name')); |
|
95 | } |
|
96 | } |
|
97 |
@@ 9-92 (lines=84) @@ | ||
6 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
7 | use Symfony\Component\Console\Input\InputArgument; |
|
8 | ||
9 | final class NotificationMakeCommand extends GeneratorCommand |
|
10 | { |
|
11 | ||
12 | use ModuleCommandTrait; |
|
13 | ||
14 | /** |
|
15 | * The console command name. |
|
16 | * |
|
17 | * @var string |
|
18 | */ |
|
19 | protected $name = 'module:make-notification'; |
|
20 | ||
21 | protected $argumentName = 'name'; |
|
22 | ||
23 | /** |
|
24 | * The console command description. |
|
25 | * |
|
26 | * @var string |
|
27 | */ |
|
28 | protected $description = 'Create a new notification class for the specified module.'; |
|
29 | ||
30 | ||
31 | /** |
|
32 | * @return string |
|
33 | */ |
|
34 | public function getDefaultNamespace() |
|
35 | { |
|
36 | return 'Notifications'; |
|
37 | } |
|
38 | ||
39 | ||
40 | /** |
|
41 | * Get template contents. |
|
42 | * |
|
43 | * @return string |
|
44 | */ |
|
45 | protected function getTemplateContents() |
|
46 | { |
|
47 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
48 | ||
49 | return (new Stub('/notification.stub', [ |
|
50 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
51 | 'CLASS' => $this->getClass(), |
|
52 | ]))->render(); |
|
53 | } |
|
54 | ||
55 | ||
56 | /** |
|
57 | * Get the destination file path. |
|
58 | * |
|
59 | * @return string |
|
60 | */ |
|
61 | protected function getDestinationFilePath() |
|
62 | { |
|
63 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
64 | ||
65 | $mailPath = $this->laravel['modules']->config('paths.generator.notifications', 'Notifications'); |
|
66 | ||
67 | return $path.$mailPath.'/'.$this->getFileName().'.php'; |
|
68 | } |
|
69 | ||
70 | ||
71 | /** |
|
72 | * @return string |
|
73 | */ |
|
74 | private function getFileName() |
|
75 | { |
|
76 | return studly_case($this->argument('name')); |
|
77 | } |
|
78 | ||
79 | ||
80 | /** |
|
81 | * Get the console command arguments. |
|
82 | * |
|
83 | * @return array |
|
84 | */ |
|
85 | protected function getArguments() |
|
86 | { |
|
87 | return [ |
|
88 | ['name', InputArgument::REQUIRED, 'The name of the notification class.'], |
|
89 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
90 | ]; |
|
91 | } |
|
92 | } |
|
93 |
@@ 10-94 (lines=85) @@ | ||
7 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
8 | use Symfony\Component\Console\Input\InputArgument; |
|
9 | ||
10 | class PolicyMakeCommand extends GeneratorCommand |
|
11 | { |
|
12 | ||
13 | use ModuleCommandTrait; |
|
14 | ||
15 | /** |
|
16 | * The name of argument name. |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $argumentName = 'name'; |
|
21 | ||
22 | /** |
|
23 | * The console command name. |
|
24 | * |
|
25 | * @var string |
|
26 | */ |
|
27 | protected $name = 'module:make-policy'; |
|
28 | ||
29 | /** |
|
30 | * The console command description. |
|
31 | * |
|
32 | * @var string |
|
33 | */ |
|
34 | protected $description = 'Create a new policy class for the specified module.'; |
|
35 | ||
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getDefaultNamespace() |
|
41 | { |
|
42 | return 'Policies'; |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * Get the console command arguments. |
|
48 | * |
|
49 | * @return array |
|
50 | */ |
|
51 | protected function getArguments() |
|
52 | { |
|
53 | return [ |
|
54 | ['name', InputArgument::REQUIRED, 'The name of the policy class.'], |
|
55 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
56 | ]; |
|
57 | } |
|
58 | ||
59 | ||
60 | /** |
|
61 | * @return mixed |
|
62 | */ |
|
63 | protected function getTemplateContents() |
|
64 | { |
|
65 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
66 | ||
67 | return (new Stub('/policy.plain.stub', [ |
|
68 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
69 | 'CLASS' => $this->getClass(), |
|
70 | ]))->render(); |
|
71 | } |
|
72 | ||
73 | ||
74 | /** |
|
75 | * @return mixed |
|
76 | */ |
|
77 | protected function getDestinationFilePath() |
|
78 | { |
|
79 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
80 | ||
81 | $policyPath = $this->laravel['modules']->config('paths.generator.policies'); |
|
82 | ||
83 | return $path.$policyPath.'/'.$this->getFileName().'.php'; |
|
84 | } |
|
85 | ||
86 | ||
87 | /** |
|
88 | * @return string |
|
89 | */ |
|
90 | private function getFileName() |
|
91 | { |
|
92 | return Str::studly($this->argument('name')); |
|
93 | } |
|
94 | } |
|
95 |
@@ 10-96 (lines=87) @@ | ||
7 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
8 | use Symfony\Component\Console\Input\InputArgument; |
|
9 | ||
10 | class RequestMakeCommand extends GeneratorCommand |
|
11 | { |
|
12 | ||
13 | use ModuleCommandTrait; |
|
14 | ||
15 | /** |
|
16 | * The name of argument name. |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $argumentName = 'name'; |
|
21 | ||
22 | /** |
|
23 | * The console command name. |
|
24 | * |
|
25 | * @var string |
|
26 | */ |
|
27 | protected $name = 'module:make-request'; |
|
28 | ||
29 | /** |
|
30 | * The console command description. |
|
31 | * |
|
32 | * @var string |
|
33 | */ |
|
34 | protected $description = 'Create a new form request class for the specified module.'; |
|
35 | ||
36 | ||
37 | /** |
|
38 | * Get default namespace. |
|
39 | * |
|
40 | * @return string |
|
41 | */ |
|
42 | public function getDefaultNamespace() |
|
43 | { |
|
44 | return 'Http\Requests'; |
|
45 | } |
|
46 | ||
47 | ||
48 | /** |
|
49 | * Get the console command arguments. |
|
50 | * |
|
51 | * @return array |
|
52 | */ |
|
53 | protected function getArguments() |
|
54 | { |
|
55 | return [ |
|
56 | ['name', InputArgument::REQUIRED, 'The name of the form request class.'], |
|
57 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
58 | ]; |
|
59 | } |
|
60 | ||
61 | ||
62 | /** |
|
63 | * @return mixed |
|
64 | */ |
|
65 | protected function getTemplateContents() |
|
66 | { |
|
67 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
68 | ||
69 | return (new Stub('/request.stub', [ |
|
70 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
71 | 'CLASS' => $this->getClass(), |
|
72 | ]))->render(); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * @return mixed |
|
78 | */ |
|
79 | protected function getDestinationFilePath() |
|
80 | { |
|
81 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
82 | ||
83 | $seederPath = $this->laravel['modules']->config('paths.generator.request'); |
|
84 | ||
85 | return $path.$seederPath.'/'.$this->getFileName().'.php'; |
|
86 | } |
|
87 | ||
88 | ||
89 | /** |
|
90 | * @return string |
|
91 | */ |
|
92 | private function getFileName() |
|
93 | { |
|
94 | return Str::studly($this->argument('name')); |
|
95 | } |
|
96 | } |
|
97 |
@@ 10-94 (lines=85) @@ | ||
7 | use Nwidart\Modules\Traits\ModuleCommandTrait; |
|
8 | use Symfony\Component\Console\Input\InputArgument; |
|
9 | ||
10 | class RuleMakeCommand extends GeneratorCommand |
|
11 | { |
|
12 | ||
13 | use ModuleCommandTrait; |
|
14 | ||
15 | /** |
|
16 | * The name of argument name. |
|
17 | * |
|
18 | * @var string |
|
19 | */ |
|
20 | protected $argumentName = 'name'; |
|
21 | ||
22 | /** |
|
23 | * The console command name. |
|
24 | * |
|
25 | * @var string |
|
26 | */ |
|
27 | protected $name = 'module:make-rule'; |
|
28 | ||
29 | /** |
|
30 | * The console command description. |
|
31 | * |
|
32 | * @var string |
|
33 | */ |
|
34 | protected $description = 'Create a new validation rule for the specified module.'; |
|
35 | ||
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getDefaultNamespace() |
|
41 | { |
|
42 | return 'Rules'; |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * Get the console command arguments. |
|
48 | * |
|
49 | * @return array |
|
50 | */ |
|
51 | protected function getArguments() |
|
52 | { |
|
53 | return [ |
|
54 | ['name', InputArgument::REQUIRED, 'The name of the rule class.'], |
|
55 | ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
56 | ]; |
|
57 | } |
|
58 | ||
59 | ||
60 | /** |
|
61 | * @return mixed |
|
62 | */ |
|
63 | protected function getTemplateContents() |
|
64 | { |
|
65 | $module = $this->laravel['modules']->findOrFail($this->getModuleName()); |
|
66 | ||
67 | return (new Stub('/rule.stub', [ |
|
68 | 'NAMESPACE' => $this->getClassNamespace($module), |
|
69 | 'CLASS' => $this->getClass(), |
|
70 | ]))->render(); |
|
71 | } |
|
72 | ||
73 | ||
74 | /** |
|
75 | * @return mixed |
|
76 | */ |
|
77 | protected function getDestinationFilePath() |
|
78 | { |
|
79 | $path = $this->laravel['modules']->getModulePath($this->getModuleName()); |
|
80 | ||
81 | $rulePath = $this->laravel['modules']->config('paths.generator.rules'); |
|
82 | ||
83 | return $path.$rulePath.'/'.$this->getFileName().'.php'; |
|
84 | } |
|
85 | ||
86 | ||
87 | /** |
|
88 | * @return string |
|
89 | */ |
|
90 | private function getFileName() |
|
91 | { |
|
92 | return Str::studly($this->argument('name')); |
|
93 | } |
|
94 | } |
|
95 |