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