mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-13 08:45:01 +00:00
- Get plan from cache in StripeService.php
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Services;
|
|||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Cashier\Exceptions\IncompletePayment;
|
use Laravel\Cashier\Exceptions\IncompletePayment;
|
||||||
use Laravel\Cashier\Exceptions\PaymentActionRequired;
|
use Laravel\Cashier\Exceptions\PaymentActionRequired;
|
||||||
@@ -241,10 +242,20 @@ class StripeService
|
|||||||
*/
|
*/
|
||||||
public function getPlan($id)
|
public function getPlan($id)
|
||||||
{
|
{
|
||||||
|
if (Cache::has("plan-$id")) {
|
||||||
|
return Cache::get("plan-$id");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Cache::rememberForever("plan-$id", function () use ($id) {
|
||||||
|
|
||||||
$plan = $this->stripe->plans()->find($id);
|
$plan = $this->stripe->plans()->find($id);
|
||||||
$product = $this->stripe->products()->find($plan['product']);
|
$product = $this->stripe->products()->find($plan['product']);
|
||||||
|
|
||||||
return compact('plan', 'product');
|
return [
|
||||||
|
'plan' => $plan,
|
||||||
|
'product' => $product,
|
||||||
|
];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user