Create controller, model, view using spark command in codeigniter 4.
Step-1: Download or clone this repo.
Step-2 : Open codeigniter4 project.
Step-3 : Copy library app/Commands folder and paste into your codeigniter project app directory.
Step-4 : Copy library writable/mgdemofiles folder and paste into your codeigniter project writable directory.
Step-5 : Now you can used command and generate Controllers and Models in codeigniter4.
Open terminal or cmd promt and fire below command:
php spark make:controller ControllerName
php spark make:controller ProductController
For more help fire
php spark help make:controller
Open terminal or cmd promt and fire below command:
php spark make:model Modelname
php spark make:model ProductModel
When fire this command the table name is by default taken as product_model.
If you want use custom table name then fire below command:
php spark make:model ProductModel table=products
By default primary key is id if you want use custom then use primary keyword like below:
php spark make:model ProductModel primary=tid
For more help fire
php spark help make:model
Open terminal or cmd promt and fire below command.
php spark route:list
For specific types of methods you can pass methods name param as below:
php spark route:list methods=get,post,put
For more help fire
php spark help route:list