[FEATURE] Added sub-domain routing.

- Updated documentation.
This commit is contained in:
Simon Sessingø
2015-12-10 03:31:57 +01:00
parent 2128a24f1c
commit c74d83796f
5 changed files with 119 additions and 77 deletions
+13
View File
@@ -10,6 +10,17 @@ class RouterGroup extends RouterEntry {
parent::__construct();
}
protected function matchDomain() {
if($this->domain !== null) {
$parameters = $this->parseParameters($this->domain, request()->getHost(), '[^.]*');
if($parameters !== null) {
$this->parameters = $parameters;
}
}
}
public function renderRoute(Request $request) {
// Check if request method is allowed
$hasAccess = (!$this->method);
@@ -26,6 +37,8 @@ class RouterGroup extends RouterEntry {
throw new RouterException('Method not allowed');
}
$this->matchDomain();
return parent::renderRoute($request);
}