Skip to content

Commit

Permalink
分组绑定自动添加prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Nov 26, 2024
1 parent 1205b9d commit a42ddfa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/think/route/RuleGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ public function auto(string $bind = '', string | array $middleware = '')
public function class(string $class)
{
$this->bind = '\\' . $class;
$this->prefix('\\' . $class . '@');
return $this;
}

Expand All @@ -430,6 +431,7 @@ public function class(string $class)
public function controller(string $controller)
{
$this->bind = '@' . $controller;
$this->prefix($controller . '/');
return $this;
}

Expand All @@ -442,6 +444,7 @@ public function controller(string $controller)
public function namespace(string $namespace)
{
$this->bind = ':' . $namespace;
$this->prefix($namespace . '\\');
return $this;
}

Expand All @@ -454,6 +457,7 @@ public function namespace(string $namespace)
public function layer(string $layer)
{
$this->bind = '/' . $layer;
$this->prefix($layer . '/');
return $this;
}

Expand Down

0 comments on commit a42ddfa

Please sign in to comment.