Created
July 29, 2021 02:38
-
-
Save abishekrsrikaanth/6c54fd29391521b193930b1db8a7cb84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Observers; | |
use App\Models\StripePlan; | |
use App\Shared\Services\Stripe\API as StripeAPI; | |
class StripePlanObserver | |
{ | |
public function created(StripePlan $stripePlan): void | |
{ | |
Nova::whenServing(function (NovaRequest $request) use ($stripePlan) { | |
$api = new StripeAPI(); | |
$plan = $api->createPlan($stripePlan->name, $stripePlan->amount); | |
$stripePlan->setStripePlanInfo($plan->id, $plan->product); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment