
Finishing touches
Before completing our project, there are a few things we need to take care of in our protected/config/main.php
file to enhance the security of our application and to make our application easier to use.
It would be nice to also add some pictures of the final application.
Disabling Gii
At the beginning of our project, we enabled the Gii module to assist us in creating models for our application. Since Gii has the ability to write new files to our project, we should remove the following section from our config
file:
'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>false, 'ipFilters' => false ),
Defining a default route
Presently, if we try to visit the root URL of our application, we are presented with an error. To avoid this, we can add a route in to the routes array of our URL Manager component. With this addition, whenever we visit the root URL of our application, we will be presented with the index
action of the project's controller. Have a look at the following code:
'components'=>array( [...] 'urlManager'=>array( [...] 'rules'=>array( [...] '/' => 'projects/index' ), ) )
Adding extra routes
Finally, add two more routes to our URL Manager routes array. These routes will help us more easily access the login
and logout
actions for our site. Have a look at the following code:
'login' => 'site/login', 'logout' => 'site/logout'