mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[FEATURE] Added sub-domain routing.
- Updated documentation.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user