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

     1  package console
     2  
     3  import (
     4  	"github.com/goravel/framework/console/console"
     5  	consolecontract "github.com/goravel/framework/contracts/console"
     6  	"github.com/goravel/framework/contracts/foundation"
     7  )
     8  
     9  const Binding = "goravel.console"
    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(), 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  	artisan := app.MakeArtisan()
    26  	config := app.MakeConfig()
    27  	artisan.Register([]consolecontract.Command{
    28  		console.NewListCommand(artisan),
    29  		console.NewKeyGenerateCommand(config),
    30  		console.NewMakeCommand(),
    31  	})
    32  }