account; $designs = Cache::get('invoiceDesigns'); foreach ($designs as $design) { if ($design->id > Auth::user()->maxInvoiceDesignId()) { $designs->pull($design->id); } $design->javascript = $design->pdfmake; $design->pdfmake = null; if (in_array($design->id, [CUSTOM_DESIGN1, CUSTOM_DESIGN2, CUSTOM_DESIGN3])) { if ($javascript = $account->getCustomDesign($design->id)) { $design->javascript = $javascript; } else { $designs->forget($design->id - 1); } } } return $designs; } }