1
|
<?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
|
|
21
|
$frontRouter = new RouteList('Front');
|
22
|
$frontRouter[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
|
23
|
|
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
|
}
|
32
|
}
|