-
Notifications
You must be signed in to change notification settings - Fork 4
/
service_provider.go
55 lines (43 loc) · 1.33 KB
/
service_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package workflow
import (
"github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/foundation"
commands "github.com/hulutech-web/goravel-workflow/commands"
"github.com/hulutech-web/goravel-workflow/routes"
)
const Binding = "workflow"
var App foundation.Application
type ServiceProvider struct {
}
func (receiver *ServiceProvider) Register(app foundation.Application) {
App = app
//配置文件
app.Bind(Binding, func(app foundation.Application) (any, error) {
config := app.MakeConfig()
config.Add("workflow", map[string]any{
"Dept": "Department", //部门关联应用中的模型
"Emp": "User", //员工关联应用中的模型
})
return NewWorkflow(nil), nil
})
// 路由
routes.Api(app)
// 数据库迁移
app.Publishes("github.com/hulutech-web/goravel-workflow", map[string]string{
"migrations": app.DatabasePath("migrations"),
"seeders": app.DatabasePath("seeders"),
"factories": app.DatabasePath("factories"),
})
// 配置文件
app.Publishes("github.com/hulutech-web/goravel-workflow", map[string]string{
"config/workflow.go": app.ConfigPath("workflow.go"),
})
app.Commands([]console.Command{
commands.NewPlugin(),
})
}
func (receiver *ServiceProvider) Boot(app foundation.Application) {
app.Commands([]console.Command{
commands.NewPublishWorkflow(),
})
}