diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 84a5089..8e31c06 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -5,6 +5,7 @@ use Illuminate\Foundation\AliasLoader; use Illuminate\Foundation\Console\AboutCommand; use Spatie\LaravelPackageTools\Commands\InstallCommand; +use Spatie\LaravelPackageTools\Exceptions\InvalidPackage; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; use Cxj\LookingGlass\Commands\LookingGlassCommand; @@ -27,6 +28,9 @@ public function configurePackage(Package $package): void ->hasCommand(LookingGlassCommand::class) ->hasInstallCommand(function (InstallCommand $command) { $command + ->startWith(function (InstallCommand $command) { + $command->info('Imagine this actually working...'); + }) ->publishConfigFile() ->publishMigrations() ->askToRunMigrations() @@ -37,38 +41,45 @@ public function configurePackage(Package $package): void }); } -// public function register() -// { -// $this->app->bind('LookingGlass', function ($app) { -// return new LookingGlass(); -// }); -// } + /** + * @throws InvalidPackage + */ + public function register() + { + $this->app->bind('LookingGlass', function ($app) { + return new LookingGlass(); + }); + + parent::register(); // 🙄 + } -// public function boot(): void -// { -// // Publish config file. -//// $this->publishes([ -//// __DIR__ . '/../config/looking-glass.php' => config_path( -//// 'looking-glass.php' -//// ), -//// ]); -// -// // Register commands. -// AboutCommand::add( -// 'Looking Glass Client', -// fn() => ['Version' => '0.0.1'] -// ); -// -//// if ($this->app->runningInConsole()) { -//// $this->commands([ -//// LookingGlassCommand::class, -//// ]); -//// } -// -// // Make dependecy package(s) available. -// $this->app->register(WebhookServerServiceProvider::class); -// $loader = AliasLoader::getInstance(); -// $loader->alias('WebhookCall', WebhookCall::class); -// } + public function boot(): void + { + // Publish config file. +// $this->publishes([ +// __DIR__ . '/../config/looking-glass.php' => config_path( +// 'looking-glass.php' +// ), +// ]); + + // Register commands. + AboutCommand::add( + 'Looking Glass Client', + fn() => ['Version' => '0.0.1'] + ); + +// if ($this->app->runningInConsole()) { +// $this->commands([ +// LookingGlassCommand::class, +// ]); +// } + + // Make dependecy package(s) available. + $this->app->register(WebhookServerServiceProvider::class); + $loader = AliasLoader::getInstance(); + $loader->alias('WebhookCall', WebhookCall::class); + + parent::boot(); // 🙄 + } }