Skip to content

Commit

Permalink
Once more with feeling.
Browse files Browse the repository at this point in the history
  • Loading branch information
cxj committed Mar 5, 2023
1 parent 2824404 commit 42a1af3
Showing 1 changed file with 43 additions and 32 deletions.
75 changes: 43 additions & 32 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand All @@ -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(); // 🙄
}
}

0 comments on commit 42a1af3

Please sign in to comment.