1 |
67c41231
|
Filip Jani
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace App;
|
4 |
|
|
|
5 |
|
|
use Nette;
|
6 |
|
|
use Nette\Application\Routers\Route;
|
7 |
|
|
use Nette\Application\Routers\RouteList;
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
final class RouterFactory
|
11 |
|
|
{
|
12 |
|
|
use Nette\StaticClass;
|
13 |
|
|
|
14 |
|
|
/**
|
15 |
|
|
* @return Nette\Application\IRouter
|
16 |
|
|
*/
|
17 |
|
|
public static function createRouter()
|
18 |
|
|
{
|
19 |
|
|
$router = new RouteList;
|
20 |
f115c8b5
|
Filip Jani
|
|
21 |
|
|
$frontRouter = new RouteList('Front');
|
22 |
3416b114
|
Jan Šedivý
|
$frontRouter[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
|
23 |
f115c8b5
|
Filip Jani
|
|
24 |
|
|
$adminRouter = new RouteList('Admin');
|
25 |
|
|
$adminRouter[] = new Route('admin/<presenter>/<action>[/<id>]', 'Default:default');
|
26 |
|
|
|
27 |
|
|
$router[] = $adminRouter;
|
28 |
|
|
$router[] = $frontRouter;
|
29 |
|
|
|
30 |
|
|
return $router;
|
31 |
67c41231
|
Filip Jani
|
}
|
32 |
|
|
}
|