How to generate a controller and views by using Gii in Yii Framework 2

In tutorial I will speak again about Gii. I will show you how you can create a controller and views that implement CRUD (Create, Read, Update, Delete) operations for the specified data model.

So, go to your Gii and click on the Start button where is CRUD Generator.

I have created a table in my database and I have created a model by using Gii for my table. Now you must fill in the form with this informations(You can change Test with your table name):

image

Next, click on the Preview button and on the Generate button to create your controller and views files.

Now, go to http://localhost/yii/web/index.php?r=test/index and you will see your created pages.

Video tutorial:









Leave a Comment