mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-11-27 05:39:55 +08:00
New plugin API: pushMiddleware
This commit is contained in:
parent
a94b526179
commit
2f08a7db37
@ -133,4 +133,9 @@ class Hook
|
||||
{
|
||||
Notification::send($users, new Notifications\SiteMessage($title, $content));
|
||||
}
|
||||
|
||||
public static function pushMiddleware($middleware)
|
||||
{
|
||||
app()->make('Illuminate\Contracts\Http\Kernel')->pushMiddleware($middleware);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
- New plugin API: [`Hook::addUserBadge`](https://bs-plugin.netlify.com/guide/bootstrap.html#%E6%98%BE%E7%A4%BA%E7%94%A8%E6%88%B7-badge).
|
||||
- New feature: Notifications.
|
||||
- New plugin API: [`Hook::sendNotification`](https://bs-plugin.netlify.com/guide/bootstrap.html#%E5%8F%91%E9%80%81%E9%80%9A%E7%9F%A5)
|
||||
- New plugin API: [`Hook::pushMiddleware`](https://bs-plugin.netlify.com/guide/bootstrap.html#%E6%B3%A8%E5%86%8C%E4%B8%AD%E9%97%B4%E4%BB%B6)
|
||||
|
||||
## Tweaked
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
- 新插件 API:[`Hook::addUserBadge`](https://bs-plugin.netlify.com/guide/bootstrap.html#%E6%98%BE%E7%A4%BA%E7%94%A8%E6%88%B7-badge)
|
||||
- 新功能:发送通知。
|
||||
- 新插件 API:[`Hook::sendNotification`](https://bs-plugin.netlify.com/guide/bootstrap.html#%E5%8F%91%E9%80%81%E9%80%9A%E7%9F%A5)
|
||||
- 新插件 API:[`Hook::pushMiddleware`](https://bs-plugin.netlify.com/guide/bootstrap.html#%E6%B3%A8%E5%86%8C%E4%B8%AD%E9%97%B4%E4%BB%B6)
|
||||
|
||||
## 调整
|
||||
|
||||
|
@ -103,4 +103,17 @@ class HookTest extends TestCase
|
||||
->assertSee('<span class="label label-warning notifications-counter">1</span>')
|
||||
->assertSee('Ibara Mayaka');
|
||||
}
|
||||
|
||||
public function testPushMiddleware()
|
||||
{
|
||||
Hook::pushMiddleware(get_class(new class {
|
||||
public function handle($request, $next)
|
||||
{
|
||||
$response = $next($request);
|
||||
$response->header('X-Middleware-Test', 'value');
|
||||
return $response;
|
||||
}
|
||||
}));
|
||||
$this->get('/')->assertHeader('X-Middleware-Test');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user