| @@ 5-93 (lines=89) @@ | ||
| 2 | ||
| 3 | namespace Caffeinated\Modules\Console\Generators;  | 
                                |
| 4 | ||
| 5 | class MakeMiddlewareCommand extends MakeCommand  | 
                                |
| 6 | { | 
                                |
| 7 | /**  | 
                                |
| 8 | * The name and signature of the console command.  | 
                                |
| 9 | *  | 
                                |
| 10 | * @var string  | 
                                |
| 11 | */  | 
                                |
| 12 | protected $signature = 'make:module:middleware  | 
                                |
| 13 |     	{slug : The slug of the module.} | 
                                |
| 14 |     	{name : The name of the middleware class.}'; | 
                                |
| 15 | ||
| 16 | /**  | 
                                |
| 17 | * The console command description.  | 
                                |
| 18 | *  | 
                                |
| 19 | * @var string  | 
                                |
| 20 | */  | 
                                |
| 21 | protected $description = 'Create a new module middleware class';  | 
                                |
| 22 | ||
| 23 | /**  | 
                                |
| 24 | * String to store the command type.  | 
                                |
| 25 | *  | 
                                |
| 26 | * @var string  | 
                                |
| 27 | */  | 
                                |
| 28 | protected $type = 'Middleware';  | 
                                |
| 29 | ||
| 30 | /**  | 
                                |
| 31 | * Module folders to be created.  | 
                                |
| 32 | *  | 
                                |
| 33 | * @var array  | 
                                |
| 34 | */  | 
                                |
| 35 | protected $listFolders = [  | 
                                |
| 36 | 'Http/Middleware/'  | 
                                |
| 37 | ];  | 
                                |
| 38 | ||
| 39 | /**  | 
                                |
| 40 | * Module files to be created.  | 
                                |
| 41 | *  | 
                                |
| 42 | * @var array  | 
                                |
| 43 | */  | 
                                |
| 44 | protected $listFiles = [  | 
                                |
| 45 | 		'{{filename}}.php' | 
                                |
| 46 | ];  | 
                                |
| 47 | ||
| 48 | /**  | 
                                |
| 49 | * Module stubs used to populate defined files.  | 
                                |
| 50 | *  | 
                                |
| 51 | * @var array  | 
                                |
| 52 | */  | 
                                |
| 53 | protected $listStubs = [  | 
                                |
| 54 | 'default' => [  | 
                                |
| 55 | 'middleware.stub'  | 
                                |
| 56 | ]  | 
                                |
| 57 | ];  | 
                                |
| 58 | ||
| 59 | /**  | 
                                |
| 60 | * Resolve Container after getting file path  | 
                                |
| 61 | *  | 
                                |
| 62 | * @param string $FilePath  | 
                                |
| 63 | * @return Array  | 
                                |
| 64 | */  | 
                                |
| 65 | protected function resolveByPath($filePath)  | 
                                |
| 66 |     { | 
                                |
| 67 | $this->container['filename'] = $this->makeFileName($filePath);  | 
                                |
| 68 | $this->container['namespace'] = $this->getNamespace($filePath);  | 
                                |
| 69 | $this->container['classname'] = basename($filePath);  | 
                                |
| 70 | }  | 
                                |
| 71 | ||
| 72 | /**  | 
                                |
| 73 | * Replace placeholder text with correct values.  | 
                                |
| 74 | *  | 
                                |
| 75 | * @return string  | 
                                |
| 76 | */  | 
                                |
| 77 | protected function formatContent($content)  | 
                                |
| 78 |     { | 
                                |
| 79 | return str_replace(  | 
                                |
| 80 | [  | 
                                |
| 81 |                 '{{filename}}', | 
                                |
| 82 |                 '{{namespace}}',  | 
                                |
| 83 |                 '{{classname}}' | 
                                |
| 84 | ],  | 
                                |
| 85 | [  | 
                                |
| 86 | $this->container['filename'],  | 
                                |
| 87 | $this->container['namespace'],  | 
                                |
| 88 | $this->container['classname']  | 
                                |
| 89 | ],  | 
                                |
| 90 | $content  | 
                                |
| 91 | );  | 
                                |
| 92 | }  | 
                                |
| 93 | }  | 
                                |
| @@ 5-93 (lines=89) @@ | ||
| 2 | ||
| 3 | namespace Caffeinated\Modules\Console\Generators;  | 
                                |
| 4 | ||
| 5 | class MakeModelCommand extends MakeCommand  | 
                                |
| 6 | { | 
                                |
| 7 | /**  | 
                                |
| 8 | * The name and signature of the console command.  | 
                                |
| 9 | *  | 
                                |
| 10 | * @var string  | 
                                |
| 11 | */  | 
                                |
| 12 | protected $signature = 'make:module:model  | 
                                |
| 13 |     	{slug : The slug of the module.} | 
                                |
| 14 |     	{name : The name of the model class.}'; | 
                                |
| 15 | ||
| 16 | /**  | 
                                |
| 17 | * The console command description.  | 
                                |
| 18 | *  | 
                                |
| 19 | * @var string  | 
                                |
| 20 | */  | 
                                |
| 21 | protected $description = 'Create a new module model class';  | 
                                |
| 22 | ||
| 23 | /**  | 
                                |
| 24 | * String to store the command type.  | 
                                |
| 25 | *  | 
                                |
| 26 | * @var string  | 
                                |
| 27 | */  | 
                                |
| 28 | protected $type = 'Model';  | 
                                |
| 29 | ||
| 30 | /**  | 
                                |
| 31 | * Module folders to be created.  | 
                                |
| 32 | *  | 
                                |
| 33 | * @var array  | 
                                |
| 34 | */  | 
                                |
| 35 | protected $listFolders = [  | 
                                |
| 36 | 'Entities/'  | 
                                |
| 37 | ];  | 
                                |
| 38 | ||
| 39 | /**  | 
                                |
| 40 | * Module files to be created.  | 
                                |
| 41 | *  | 
                                |
| 42 | * @var array  | 
                                |
| 43 | */  | 
                                |
| 44 | protected $listFiles = [  | 
                                |
| 45 | 		'{{filename}}.php' | 
                                |
| 46 | ];  | 
                                |
| 47 | ||
| 48 | /**  | 
                                |
| 49 | * Module stubs used to populate defined files.  | 
                                |
| 50 | *  | 
                                |
| 51 | * @var array  | 
                                |
| 52 | */  | 
                                |
| 53 | protected $listStubs = [  | 
                                |
| 54 | 'default' => [  | 
                                |
| 55 | 'model.stub'  | 
                                |
| 56 | ]  | 
                                |
| 57 | ];  | 
                                |
| 58 | ||
| 59 | /**  | 
                                |
| 60 | * Resolve Container after getting file path  | 
                                |
| 61 | *  | 
                                |
| 62 | * @param string $FilePath  | 
                                |
| 63 | * @return Array  | 
                                |
| 64 | */  | 
                                |
| 65 | protected function resolveByPath($filePath)  | 
                                |
| 66 |     { | 
                                |
| 67 | $this->container['filename'] = $this->makeFileName($filePath);  | 
                                |
| 68 | $this->container['namespace'] = $this->getNamespace($filePath);  | 
                                |
| 69 | $this->container['classname'] = basename($filePath);  | 
                                |
| 70 | }  | 
                                |
| 71 | ||
| 72 | /**  | 
                                |
| 73 | * Replace placeholder text with correct values.  | 
                                |
| 74 | *  | 
                                |
| 75 | * @return string  | 
                                |
| 76 | */  | 
                                |
| 77 | protected function formatContent($content)  | 
                                |
| 78 |     { | 
                                |
| 79 | return str_replace(  | 
                                |
| 80 | [  | 
                                |
| 81 |                 '{{filename}}', | 
                                |
| 82 |                 '{{namespace}}',  | 
                                |
| 83 |                 '{{classname}}' | 
                                |
| 84 | ],  | 
                                |
| 85 | [  | 
                                |
| 86 | $this->container['filename'],  | 
                                |
| 87 | $this->container['namespace'],  | 
                                |
| 88 | $this->container['classname']  | 
                                |
| 89 | ],  | 
                                |
| 90 | $content  | 
                                |
| 91 | );  | 
                                |
| 92 | }  | 
                                |
| 93 | }  | 
                                |
| @@ 5-93 (lines=89) @@ | ||
| 2 | ||
| 3 | namespace Caffeinated\Modules\Console\Generators;  | 
                                |
| 4 | ||
| 5 | class MakeRequestCommand extends MakeCommand  | 
                                |
| 6 | { | 
                                |
| 7 | /**  | 
                                |
| 8 | * The name and signature of the console command.  | 
                                |
| 9 | *  | 
                                |
| 10 | * @var string  | 
                                |
| 11 | */  | 
                                |
| 12 | protected $signature = 'make:module:request  | 
                                |
| 13 |     	{slug : The slug of the module.} | 
                                |
| 14 |     	{name : The name of the request class.}'; | 
                                |
| 15 | ||
| 16 | /**  | 
                                |
| 17 | * The console command description.  | 
                                |
| 18 | *  | 
                                |
| 19 | * @var string  | 
                                |
| 20 | */  | 
                                |
| 21 | protected $description = 'Create a new module request class';  | 
                                |
| 22 | ||
| 23 | /**  | 
                                |
| 24 | * String to store the command type.  | 
                                |
| 25 | *  | 
                                |
| 26 | * @var string  | 
                                |
| 27 | */  | 
                                |
| 28 | protected $type = 'Request';  | 
                                |
| 29 | ||
| 30 | /**  | 
                                |
| 31 | * Module folders to be created.  | 
                                |
| 32 | *  | 
                                |
| 33 | * @var array  | 
                                |
| 34 | */  | 
                                |
| 35 | protected $listFolders = [  | 
                                |
| 36 | 'Http/Requests/'  | 
                                |
| 37 | ];  | 
                                |
| 38 | ||
| 39 | /**  | 
                                |
| 40 | * Module files to be created.  | 
                                |
| 41 | *  | 
                                |
| 42 | * @var array  | 
                                |
| 43 | */  | 
                                |
| 44 | protected $listFiles = [  | 
                                |
| 45 | 		'{{filename}}.php' | 
                                |
| 46 | ];  | 
                                |
| 47 | ||
| 48 | /**  | 
                                |
| 49 | * Module stubs used to populate defined files.  | 
                                |
| 50 | *  | 
                                |
| 51 | * @var array  | 
                                |
| 52 | */  | 
                                |
| 53 | protected $listStubs = [  | 
                                |
| 54 | 'default' => [  | 
                                |
| 55 | 'request.stub'  | 
                                |
| 56 | ]  | 
                                |
| 57 | ];  | 
                                |
| 58 | ||
| 59 | /**  | 
                                |
| 60 | * Resolve Container after getting file path  | 
                                |
| 61 | *  | 
                                |
| 62 | * @param string $FilePath  | 
                                |
| 63 | * @return Array  | 
                                |
| 64 | */  | 
                                |
| 65 | protected function resolveByPath($filePath)  | 
                                |
| 66 |     { | 
                                |
| 67 | $this->container['filename'] = $this->makeFileName($filePath);  | 
                                |
| 68 | $this->container['namespace'] = $this->getNamespace($filePath);  | 
                                |
| 69 | $this->container['classname'] = basename($filePath);  | 
                                |
| 70 | }  | 
                                |
| 71 | ||
| 72 | /**  | 
                                |
| 73 | * Replace placeholder text with correct values.  | 
                                |
| 74 | *  | 
                                |
| 75 | * @return string  | 
                                |
| 76 | */  | 
                                |
| 77 | protected function formatContent($content)  | 
                                |
| 78 |     { | 
                                |
| 79 | return str_replace(  | 
                                |
| 80 | [  | 
                                |
| 81 |                 '{{filename}}', | 
                                |
| 82 |                 '{{namespace}}',  | 
                                |
| 83 |                 '{{classname}}' | 
                                |
| 84 | ],  | 
                                |
| 85 | [  | 
                                |
| 86 | $this->container['filename'],  | 
                                |
| 87 | $this->container['namespace'],  | 
                                |
| 88 | $this->container['classname']  | 
                                |
| 89 | ],  | 
                                |
| 90 | $content  | 
                                |
| 91 | );  | 
                                |
| 92 | }  | 
                                |
| 93 | }  | 
                                |
| @@ 5-93 (lines=89) @@ | ||
| 2 | ||
| 3 | namespace Caffeinated\Modules\Console\Generators;  | 
                                |
| 4 | ||
| 5 | class MakeSeederCommand extends MakeCommand  | 
                                |
| 6 | { | 
                                |
| 7 | /**  | 
                                |
| 8 | * The name and signature of the console command.  | 
                                |
| 9 | *  | 
                                |
| 10 | * @var string  | 
                                |
| 11 | */  | 
                                |
| 12 | protected $signature = 'make:module:seeder  | 
                                |
| 13 |     	{slug : The slug of the module.} | 
                                |
| 14 |     	{name : The name of the seeder class.}'; | 
                                |
| 15 | ||
| 16 | /**  | 
                                |
| 17 | * The console command description.  | 
                                |
| 18 | *  | 
                                |
| 19 | * @var string  | 
                                |
| 20 | */  | 
                                |
| 21 | protected $description = 'Create a new module seeder class';  | 
                                |
| 22 | ||
| 23 | /**  | 
                                |
| 24 | * String to store the command type.  | 
                                |
| 25 | *  | 
                                |
| 26 | * @var string  | 
                                |
| 27 | */  | 
                                |
| 28 | protected $type = 'Seeder';  | 
                                |
| 29 | ||
| 30 | /**  | 
                                |
| 31 | * Module folders to be created.  | 
                                |
| 32 | *  | 
                                |
| 33 | * @var array  | 
                                |
| 34 | */  | 
                                |
| 35 | protected $listFolders = [  | 
                                |
| 36 | 'Database/Seeds/'  | 
                                |
| 37 | ];  | 
                                |
| 38 | ||
| 39 | /**  | 
                                |
| 40 | * Module files to be created.  | 
                                |
| 41 | *  | 
                                |
| 42 | * @var array  | 
                                |
| 43 | */  | 
                                |
| 44 | protected $listFiles = [  | 
                                |
| 45 | 		'{{filename}}.php' | 
                                |
| 46 | ];  | 
                                |
| 47 | ||
| 48 | /**  | 
                                |
| 49 | * Module stubs used to populate defined files.  | 
                                |
| 50 | *  | 
                                |
| 51 | * @var array  | 
                                |
| 52 | */  | 
                                |
| 53 | protected $listStubs = [  | 
                                |
| 54 | 'default' => [  | 
                                |
| 55 | 'seeder_plus.stub'  | 
                                |
| 56 | ]  | 
                                |
| 57 | ];  | 
                                |
| 58 | ||
| 59 | /**  | 
                                |
| 60 | * Resolve Container after getting file path  | 
                                |
| 61 | *  | 
                                |
| 62 | * @param string $FilePath  | 
                                |
| 63 | * @return Array  | 
                                |
| 64 | */  | 
                                |
| 65 | protected function resolveByPath($filePath)  | 
                                |
| 66 |     { | 
                                |
| 67 | $this->container['filename'] = $this->makeFileName($filePath);  | 
                                |
| 68 | $this->container['namespace'] = $this->getNamespace($filePath);  | 
                                |
| 69 | $this->container['classname'] = basename($filePath);  | 
                                |
| 70 | }  | 
                                |
| 71 | ||
| 72 | /**  | 
                                |
| 73 | * Replace placeholder text with correct values.  | 
                                |
| 74 | *  | 
                                |
| 75 | * @return string  | 
                                |
| 76 | */  | 
                                |
| 77 | protected function formatContent($content)  | 
                                |
| 78 |     { | 
                                |
| 79 | return str_replace(  | 
                                |
| 80 | [  | 
                                |
| 81 |                 '{{filename}}', | 
                                |
| 82 |                 '{{namespace}}',  | 
                                |
| 83 |                 '{{classname}}' | 
                                |
| 84 | ],  | 
                                |
| 85 | [  | 
                                |
| 86 | $this->container['filename'],  | 
                                |
| 87 | $this->container['namespace'],  | 
                                |
| 88 | $this->container['classname']  | 
                                |
| 89 | ],  | 
                                |
| 90 | $content  | 
                                |
| 91 | );  | 
                                |
| 92 | }  | 
                                |
| 93 | }  | 
                                |