Now we'll fetch the data from our table child. Here our Yiii2 folder is named as read.
Step 1 Create Model file
Create a model file child.php in frontend/models folder.
Step 2 Add action to read
In the ChildController.php file, we need to add the action actionIndex to fetch the data from the table.
Look at the above code, all code is same only action to fetch data is added in the last.
Step 3 Create View file
In the frontend/views/child folder, create a file index.php.
Step 4 Run it
Run it on the browser,.