开发者

how to generate crud in modules folder in yii

开发者 https://www.devze.com 2023-03-02 01:47 出处:网络
I am try create CRUD开发者_运维百科 Through GII in YII Framework in modules folder .But there one option to change the CRUD path.I looked around for this too. Hope this will help.

I am try create CRUD开发者_运维百科 Through GII in YII Framework in modules folder .But there one option to change the CRUD path.


I looked around for this too. Hope this will help.

  1. Create a module via Module Generator.
  2. Register your module name in the config main.php (modules array)
  3. Create a model via Model Generator. Fill in the fields and put this in Model Path : application.modules.[module-name].models
  4. Create crud via Crud Generator. Fill in the fields and put this in Model Class: [module-name].models.[model-name]

Sorry the reference is in Indonesian. Source


  1. Create a module via Module Generator.
  2. Register your module name in the config main.php (modules array)
  3. Create a model via Model Generator. Fill in the fields and put this in Model Path : application.modules.[module-name].models
  4. Create crud via Crud Generator. Fill in the fields and put this in Model Class: [module-name].models.[model-name] add module name in Controller ID :[module-name]/[Controller-name]


  • module-name/user generates module-name/UserController.php. If the application has an module-name module enabled, it will generate UserController (and other CRUD code) within the module module-name instead.


Maybe is useful to create controllers

how to generate crud in modules folder in yii

like that you can get it your controller and view inside the module you want. Regarding the models, I am agree with previous answers.

Byee


Model Class: user_access.models.User

Controller ID: user_access/user


Model Class : application.modules.guestbook.models.Guestbook

Controller ID : guestbook/Default

Note : guestbook is my module name and i created crud directly inside guestbook folder using above path.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号