-
Notifications
You must be signed in to change notification settings - Fork 10
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';
}
]);
- Home
- Getting Started
- Server Config
- Installation
- Installing Composer
- App
- Route Shorthand
- Config
- Routes
- Methods
- Controller Types
- Params & Regex
- Aliases
- Dependency Injection
- Advanced Routing
- Services
- User Defined Services
- Built in Services
- Middleware
- Views
- Templates
- Scope
- Resource
- Factory
- Looper
- Examples
- Plugins
- About