Skip to content

Commit

Permalink
Register event listener for ShopifyAppInstalled event
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdierich committed Dec 19, 2023
1 parent 1503781 commit a6bf8ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public function up(): void
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('shopify_sessions', function (Blueprint $table) {
Expand Down
9 changes: 9 additions & 0 deletions src/LaravelShopifyIntegrationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

namespace Codelayer\LaravelShopifyIntegration;

use Codelayer\LaravelShopifyIntegration\Events\ShopifyAppInstalled;
use Codelayer\LaravelShopifyIntegration\Http\Middleware\EnsureShopifyInstalled;
use Codelayer\LaravelShopifyIntegration\Http\Middleware\EnsureShopifySession;
use Codelayer\LaravelShopifyIntegration\Lib\DbSessionStorage;
use Codelayer\LaravelShopifyIntegration\Listeners\RefreshShopDevelopmentState;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Event;
use Shopify\ApiVersion;
use Shopify\Context;
use Shopify\Exception\MissingArgumentException;
Expand Down Expand Up @@ -33,11 +36,17 @@ public function configurePackage(Package $package): void

try {
$this->configureShopifyContext();
$this->configurePackageEvents();
} catch (MissingArgumentException $e) {
report($e);
}
}

private function configurePackageEvents(): void
{
Event::listen(ShopifyAppInstalled::class, RefreshShopDevelopmentState::class);
}

/**
* @throws MissingArgumentException
*/
Expand Down

0 comments on commit a6bf8ab

Please sign in to comment.