Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.idea
.vscode
.DS_Store
storage/framework
launch.json
.env
.env.*
!.env.example
storage
tmp
2 changes: 1 addition & 1 deletion app/http/controllers/validation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (r *ValidationController) Request(ctx http.Context) http.Response {
}

func (r *ValidationController) Form(ctx http.Context) http.Response {
validator, err := facades.Validation().Make(map[string]any{
validator, err := facades.Validation().Make(ctx, map[string]any{
"name": ctx.Request().Input("name"),
}, map[string]string{
"name": "required",
Expand Down
6 changes: 4 additions & 2 deletions app/rules/exists.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package rules

import (
"context"

"github.com/goravel/framework/contracts/validation"
"github.com/goravel/framework/facades"
)
Expand All @@ -23,7 +25,7 @@ func (receiver *Exists) Signature() string {
}

// Passes Determine if the validation rule passes.
func (receiver *Exists) Passes(_ validation.Data, val any, options ...any) bool {
func (receiver *Exists) Passes(ctx context.Context, _ validation.Data, val any, options ...any) bool {

tableName := options[0].(string)
fieldName := options[1].(string)
Expand All @@ -49,6 +51,6 @@ func (receiver *Exists) Passes(_ validation.Data, val any, options ...any) bool
}

// Message Get the validation error message.
func (receiver *Exists) Message() string {
func (receiver *Exists) Message(ctx context.Context) string {
return "record does not exist"
}
6 changes: 4 additions & 2 deletions app/rules/not_exists.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package rules

import (
"context"

"github.com/goravel/framework/contracts/validation"
"github.com/goravel/framework/facades"
)
Expand All @@ -23,7 +25,7 @@ func (receiver *NotExists) Signature() string {
}

// Passes Determine if the validation rule passes.
func (receiver *NotExists) Passes(_ validation.Data, val any, options ...any) bool {
func (receiver *NotExists) Passes(ctx context.Context, _ validation.Data, val any, options ...any) bool {

tableName := options[0].(string)
fieldName := options[1].(string)
Expand All @@ -49,6 +51,6 @@ func (receiver *NotExists) Passes(_ validation.Data, val any, options ...any) bo
}

// Message Get the validation error message.
func (receiver *NotExists) Message() string {
func (receiver *NotExists) Message(ctx context.Context) string {
return "record already exists"
}
17 changes: 10 additions & 7 deletions config/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ func init() {
"key": "",
},
},
"client": map[string]any{
"base_url": config.GetString("HTTP_CLIENT_BASE_URL", "http://127.0.0.1:3000"),
"timeout": config.GetDuration("HTTP_CLIENT_TIMEOUT"),
"max_idle_conns": config.GetInt("HTTP_CLIENT_MAX_IDLE_CONNS"),
"max_idle_conns_per_host": config.GetInt("HTTP_CLIENT_MAX_IDLE_CONNS_PER_HOST"),
"max_conns_per_host": config.GetInt("HTTP_CLIENT_MAX_CONN_PER_HOST"),
"idle_conn_timeout": config.GetDuration("HTTP_CLIENT_IDLE_CONN_TIMEOUT"),
"default_client": config.Env("HTTP_CLIENT_DEFAULT", "default"),
"clients": map[string]any{
"default": map[string]any{
"base_url": config.Env("HTTP_CLIENT_BASE_URL", ""),
"timeout": config.Env("HTTP_CLIENT_TIMEOUT", "30s"),
"max_idle_conns": config.Env("HTTP_CLIENT_MAX_IDLE_CONNS", 100),
"max_idle_conns_per_host": config.Env("HTTP_CLIENT_MAX_IDLE_CONNS_PER_HOST", 2),
"max_conns_per_host": config.Env("HTTP_CLIENT_MAX_CONN_PER_HOST", 0),
"idle_conn_timeout": config.Env("HTTP_CLIENT_IDLE_CONN_TIMEOUT", "90s"),
},
},
})
}
23 changes: 23 additions & 0 deletions config/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,28 @@ func init() {
"username": config.Env("MAIL_USERNAME"),

"password": config.Env("MAIL_PASSWORD"),

// Template Configuration
//
// This controls template rendering for email views. Template engines are cached
// globally and support both built-in drivers and custom implementations via factories.
//
// Available Drivers: "html", "custom"
"template": map[string]any{
"default": config.Env("MAIL_TEMPLATE_ENGINE", "html"),
"engines": map[string]any{
"html": map[string]any{
"driver": "html",
"path": config.Env("MAIL_VIEWS_PATH", "resources/views/mail"),
},
// Example custom template engine:
// "blade": map[string]any{
// "driver": "custom",
// "via": func() (mail.Template, error) {
// return NewBladeTemplateEngine(), nil
// },
// },
},
},
})
}
Loading
Loading