From 2e73e47dcc6355a2c2ae1a4bde614ea3c4ac81df Mon Sep 17 00:00:00 2001 From: "monken,wu" <610877102@mail.nknu.edu.tw> Date: Tue, 10 Mar 2020 01:14:56 +0800 Subject: [PATCH 1/4] Update README.md --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 950a628..34e7f65 100644 --- a/README.md +++ b/README.md @@ -1 +1,81 @@ -# CodeIgniter4_CLI-Create \ No newline at end of file +# CodeIgniter4_CLI-Create + +Cli-Create is based on CodeIgniter4. It will help you generate template files more quickly when developing projects with CodeIgniter4. + +## Install + +### Prerequisites +1. CodeIgniter Framework 4.* +2. Composer + +### Composer Install + +``` +composer require monken/cli-create +``` +### Use Library + +Open Terminal in Mac/Linux or go to Run > “cmd” in Windows and navigate to CodeIgniter4 project’s root: + +``` +php spark list +``` + +Now, if you see the following message, the installation is successful. + +``` +CodeIgniter CLI Tool - Version 4.0.2 - Server-Time: 2020-03-09 12:04:21pm + + +Cli-Create + create:controller Create a new controller file. + create:model Create a new model file. +``` + +## Quick Start + +### create:controller + +Create a new controller file. + +* Use + ``` + $ php spark create:controller [controller_name] [Options] + ``` + +* Description: + ``` + Create a new controller file. + ``` +* Arguments: + 1. controller_name : The controller name. +* Options: + ``` + -nobase Do not extends BaseControllers Class. + -usemodel Choose models. + -space Create folders and files according to the path you typed. + ``` + +### create:model + +Create a new model file. + +* Use + ``` + $ php spark create:model [model_name] [entity_name] [Options] + ``` + +* Description: + ``` + Create a new controller file. + ``` +* Arguments: + 1. model_name : The model name + 2. entity_name : The entity name. If you selected -entity option. You can type this arguments. +* Options: + ``` + -basic Creates a basic model file. + -entity Uses Entity Classes. + -manual Creates a Manual Model. + -space Creates folders and files according to the path you typed. + ``` From 1cdbf8596a922fc8345e2d3d9996d2b5a78cdfad Mon Sep 17 00:00:00 2001 From: "monken,wu" <610877102@mail.nknu.edu.tw> Date: Tue, 10 Mar 2020 11:06:40 +0800 Subject: [PATCH 2/4] add model Guide --- README.md | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 154 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 34e7f65..a485f95 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ Cli-Create create:model Create a new model file. ``` -## Quick Start +# Guide -### create:controller +## create:controller Create a new controller file. @@ -49,6 +49,7 @@ Create a new controller file. ``` * Arguments: 1. controller_name : The controller name. + * Options: ``` -nobase Do not extends BaseControllers Class. @@ -56,7 +57,7 @@ Create a new controller file. -space Create folders and files according to the path you typed. ``` -### create:model +## create:model Create a new model file. @@ -79,3 +80,153 @@ Create a new model file. -manual Creates a Manual Model. -space Creates folders and files according to the path you typed. ``` + +### Create a normal model + +The model class has a few configuration options that can be set to allow the class’ methods to work seamlessly for you. + +You can use : + +``` +$ php spark create:model [model_name] +``` + +Now, in "app/Models" You can see the new Model File like this : + +```php +db =& $db; + } +} +``` + +### Create a entity model + +CodeIgniter supports Entity classes as a first-class citizen in it’s database layer, while keeping them completely optional to use. They are commonly used as part of the Repository pattern, but can be used directly with the Model if that fits your needs better. + +You can use this command : + +``` +$ php spark create:model [model_name] [entity_name] -entity +``` +Now, in “app/Models” You can see the new Manual Model File like this : + +```php + Date: Tue, 10 Mar 2020 12:28:36 +0800 Subject: [PATCH 3/4] Add Controller Guide --- README.md | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a485f95..74089ac 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Cli-Create is based on CodeIgniter4. It will help you generate template files more quickly when developing projects with CodeIgniter4. +[Guide](https://hackmd.io/@monkenWu/HJndHeESU) + ## Install ### Prerequisites @@ -56,7 +58,117 @@ Create a new controller file. -usemodel Choose models. -space Create folders and files according to the path you typed. ``` - + +### Create a normal Controller + +You can use : + +``` +$ php spark create:contorller [controller_name] +``` + +Now, in "app/Controllers" You can see the new Contorller File like this : + +```php + The namespace in Codeigniter usually maps the actual file storage path, so using this command will automatically create folders according to the value you entered. + +Now, in “app/Controllers/System/Admin” You can see the new "-nobase" Controller File like this : + +```php + The namespace in Codeigniter usually maps the actual file storage path, so using this command will automatically create folders according to the value you entered. Now, in “app/Models/Api/System” You can see the new Manual Model File like this : From 3e048038dde241483f39adb3de85148a48237805 Mon Sep 17 00:00:00 2001 From: "monken,wu" <610877102@mail.nknu.edu.tw> Date: Tue, 10 Mar 2020 12:37:01 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74089ac..414054c 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ class User extends BaseController ### Use "-nobase" Option -By default, creating a controller file will inherit the BaseController class. If you don't want the default settings, you can use: +By default, creating a controller file will extends the BaseController class. If you don't want the default settings, you can use: ``` $ php spark create:controller [controller_name] -nobase