Skip to content

Commit ffd4164

Browse files
committed
支持中间件切换store
1 parent 8ac18b8 commit ffd4164

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/Middleware/Jwt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public function __construct(App $app)
1919
$this->app = $app;
2020
}
2121

22-
public function handle($request, \Closure $next)
22+
public function handle($request, \Closure $next, $store = null)
2323
{
2424
// 暂时修复 6.0.3 options 问题
2525
if ($request->isOptions()) {
2626
return $next($request);
2727
}
2828

29-
if (true === $this->app->get('jwt')->verify()) {
29+
if (true === $this->app->get('jwt')->store($store)->verify()) {
3030

3131
$user = $this->app->get('jwt.user');
3232

src/Service/Jwt.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ public function __construct(App $app)
3333
$this->init();
3434
}
3535

36-
public function store(string $store): self
36+
public function store(string $store = null): self
3737
{
38-
$this->store = $store;
38+
if ($store) {
39+
$this->store = $store;
40+
}
3941

4042
return $this;
4143
}

0 commit comments

Comments
 (0)