Description
This PRs provide a new command shield:extend to easily extend any controller.
The Command's Usage
shield:extend
The Command's Options
protected $options = [
'-i' => 'The index of shield controllers to be extending in your app.',
'-f' => 'Force overwrite ALL existing files in destination.',
];
Example:
this@PC playground % php spark shield:extend
CodeIgniter v4.5.3 Command Line Tool - Server Time: 2024-07-09 05:32:31 UTC+07:00
List of the controller that will be extend:
[1] LoginController
[2] MagicLinkController
[3] RegisterController
Please select one of these (1/2/3) : 3
Created: APPPATH/Controllers/RegisterController.php
After extending, don't forget to change the route. See https://shield.codeigniter.com/customization/route_config
Example when the controller already exists:
this@PC playground % php spark shield:extend
CodeIgniter v4.5.3 Command Line Tool - Server Time: 2024-07-09 05:30:57 UTC+07:00
List of the controller that will be extend:
[1] LoginController
[2] MagicLinkController
[3] RegisterController
Please select one of these (1/2/3) : 3
File 'APPPATH/Controllers/RegisterController.php' already exists in destination. Overwrite? [n, y]: y
Created: APPPATH/Controllers/RegisterController.php
After extending, don't forget to change the route. See https://shield.codeigniter.com/customization/route_config
Or we can use the full option as below:
this@PC playground % php spark shield:extend -i 3 -f
CodeIgniter v4.5.3 Command Line Tool - Server Time: 2024-07-09 05:27:18 UTC+07:00
Created: APPPATH/Controllers/RegisterController.php
After extending, don't forget to change the route. See https://shield.codeigniter.com/customization/route_config
Checklist:
[x] Securely signed commits
[ ] Component(s) with PHPDoc blocks, only if necessary or adds value
Description This PRs provide a new command
shield:extend
to easily extend any controller.The Command's Usage
The Command's Options
Example:
Example when the controller already exists:
Or we can use the full option as below:
Checklist: