- Pay and subscribe from generated Subscription Request

This commit is contained in:
Peter Papp
2021-03-22 15:41:47 +01:00
parent 0db55b51d2
commit 778a94e5ba
6 changed files with 158 additions and 20 deletions

View File

@@ -43,26 +43,10 @@ class SubscriptionRequestResource extends JsonResource
]
],
'plan' => new PlanResource(
$this->get_plan($this->requested_plan)
resolve(StripeService::class)->getPlan($this->requested_plan)
),
]
],
];
}
/**
* @param $slug
* @return mixed
*/
private function get_plan($slug)
{
if (Cache::has("plan-$slug")) {
return Cache::get("plan-$slug");
}
return Cache::rememberForever("plan-$slug", function () use ($slug) {
return resolve(StripeService::class)
->getPlan($slug);
});
}
}