Routing maps your URL to specific controller’s action. In this section, we will see how you can implement routes, how you can pass arguments from URL to controller’s action, how you can generate URLs, and how you can redirect to a specific URL. Normally, routes are implemented in file config/routes.php . Routing can be implemented in two ways − static method scoped route builder Here is an example presenting both the types. // Using the scoped route builder. Router::scope('/', function ($routes) { $routes->connect('/', ['controller' => 'Articles', 'action' => 'index']); }); // Using the static method. Router::connect('/', ['controller' => 'Articles', 'action' => 'index']); Both the methods will execute the index method of ArticlesController . Out of the two methods scoped route builder gives better performance. Connecting Routes Router::connect() method is used ...
For Information Technology