scaffold-middleware
3
总安装量
3
周安装量
#57533
全站排名
安装命令
npx skills add https://github.com/iurygdeoliveira/labsis-kit --skill scaffold-middleware
Agent 安装分布
claude-code
2
windsurf
1
trae
1
codex
1
antigravity
1
Skill 文档
Laravel Middleware Pattern Skill
Use this skill when implementing request filtering or modification logic.
Rules
1. Modern Registration (Laravel 12)
- Do NOT look for
app/Http/Kernel.php(it is gone). - Register middleware in
bootstrap/app.phpusing the->withMiddleware()callback. - Use
append()for global oralias()for route-specific.
->withMiddleware(function (Middleware $middleware) {
$middleware->append(EnsureTokenIsValid::class);
$middleware->alias([
'admin' => EnsureUserIsAdmin::class,
]);
})
2. Structure
- Implement the
handlemethod with proper typing.
public function handle(Request $request, Closure $next): Response
{
if (...) {
return redirect('/home');
}
return $next($request);
}