This commit is contained in:
Joe
2026-01-16 15:49:34 +08:00
commit 550d3e1f42
380 changed files with 62024 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package middleware
import (
"github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/facades"
)
func DevelopmentOnly() http.Middleware {
return func(ctx http.Context) {
env := facades.Config().Get("app.env", "production")
if env != "local" && env != "development" {
ctx.Response().Json(http.StatusForbidden, map[string]any{
"code": 403,
"message": "This feature is only available in development mode",
})
ctx.Request().Abort()
return
}
ctx.Request().Next()
}
}