stripe = $stripe; } /** * Get all active plans * * @return PricingCollection */ public function index() { if (Cache::has('pricing')) { // Get pricing from cache $pricing = Cache::get('pricing'); } else { // Store pricing to cache $pricing = Cache::rememberForever('pricing', function () { return $this->stripe->getActivePlans(); }); } // Format pricing to collection $collection = new PricingCollection($pricing); // Sort and return pricing return $collection->sortBy('product.metadata.capacity') ->values() ->all(); } }