github.com/goravel/framework@v1.13.9/event/service_provider.go (about)

     1  package event
     2  
     3  import (
     4  	"github.com/goravel/framework/contracts/console"
     5  	"github.com/goravel/framework/contracts/foundation"
     6  	eventConsole "github.com/goravel/framework/event/console"
     7  )
     8  
     9  const Binding = "goravel.event"
    10  
    11  type ServiceProvider struct {
    12  }
    13  
    14  func (receiver *ServiceProvider) Register(app foundation.Application) {
    15  	app.Singleton(Binding, func(app foundation.Application) (any, error) {
    16  		return NewApplication(app.MakeQueue()), nil
    17  	})
    18  }
    19  
    20  func (receiver *ServiceProvider) Boot(app foundation.Application) {
    21  	receiver.registerCommands(app)
    22  }
    23  
    24  func (receiver *ServiceProvider) registerCommands(app foundation.Application) {
    25  	app.MakeArtisan().Register([]console.Command{
    26  		&eventConsole.EventMakeCommand{},
    27  		&eventConsole.ListenerMakeCommand{},
    28  	})
    29  }