Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 11
Advanced Routing
Devin Smith edited this page Dec 11, 2015
·
1 revision
If the first argument of when is an array you can create more customized routes, including multiple comma separated methods.
$tipsy->router()
->when([
'route' => 'update',
'method' => 'post,put',
'controller' => function() {
echo'Updating content...';
}
]);Here are a few different ways to define the home page using the methods described above.
$tipsy->router()
->when('', function() {
echo'Here I am';
});is the same as
$tipsy->router()
->when('/', function() {
echo'Here I am';
});is the same as
$tipsy->router()
->home(function() {
echo'Here I am';
});is the same as
$tipsy->router()
->when([
'route' => '',
'method' => '*',
'controller' => function() {
echo'Here I am';
}
]);