-
Notifications
You must be signed in to change notification settings - Fork 59
Routing
Shea Lewis edited this page Mar 7, 2015
·
1 revision
Caffeinated Menus gives you various ways to link to your resources from your menus. Let's go over each method below.
This is as easy and basic as it goes. You may simply assign a URL to your menu item by passing the URI as the second parameter when add
ing your menu item:
...
$menu->add('Blog', 'blog');
...
If you make use of the named routes functionality of Laravel, why not do the same for your menu items as well? Simply pass an array referencing the route in the second parameter, like so:
...
$menu->add('Blog', array('route' => 'blog.page'));
...
You may also link directly to controller actions in a similar manner as named routes:
...
$menu->add('Blog', array('action' => 'BlogController@index'));
...
If you need to pass along additional parameters to either the named routes or controller actions methods, simply utilize an array in place of a string like so:
...
// Named Route
$menu->add('Blog', array('route' => array('blog.page', 'slug' => 'lorem-ipsum-dolor')));
// Controller Action
$menu->add('Blog', array('action' => array('BlogController@index', 'slug' => 'lorem-ipsum-dolor')));
...
🔴 Best Temporary Email - https://1secmail.ru 🔴