mirror of
https://github.com/acepanel/panel.git
synced 2026-02-05 03:22:32 +08:00
33 lines
747 B
Go
33 lines
747 B
Go
package providers
|
|
|
|
import (
|
|
"github.com/goravel/framework/contracts/foundation"
|
|
"github.com/goravel/framework/contracts/validation"
|
|
"github.com/goravel/framework/facades"
|
|
|
|
"panel/app/rules"
|
|
)
|
|
|
|
type ValidationServiceProvider struct {
|
|
}
|
|
|
|
func (receiver *ValidationServiceProvider) Register(app foundation.Application) {
|
|
|
|
}
|
|
|
|
func (receiver *ValidationServiceProvider) Boot(app foundation.Application) {
|
|
if err := facades.Validation().AddRules(receiver.rules()); err != nil {
|
|
facades.Log().Infof("add rules error: %+v", err)
|
|
}
|
|
}
|
|
|
|
func (receiver *ValidationServiceProvider) rules() []validation.Rule {
|
|
return []validation.Rule{
|
|
&rules.Exists{},
|
|
&rules.NotExists{},
|
|
&rules.Captcha{},
|
|
&rules.PathExists{},
|
|
&rules.PathNotExists{},
|
|
}
|
|
}
|