private function initMaps() { $this->init(); $this->maps = ['client' => [], 'invoice' => [], 'invoice_client' => [], 'product' => [], 'countries' => [], 'countries2' => [], 'currencies' => [], 'client_ids' => [], 'invoice_ids' => [], 'vendors' => [], 'expense_categories' => []]; $clients = $this->clientRepo->all(); foreach ($clients as $client) { $this->addClientToMaps($client); } $invoices = $this->invoiceRepo->all(); foreach ($invoices as $invoice) { $this->addInvoiceToMaps($invoice); } $products = $this->productRepo->all(); foreach ($products as $product) { $this->addProductToMaps($product); } $countries = Cache::get('countries'); foreach ($countries as $country) { $this->maps['countries'][strtolower($country->name)] = $country->id; $this->maps['countries2'][strtolower($country->iso_3166_2)] = $country->id; } $currencies = Cache::get('currencies'); foreach ($currencies as $currency) { $this->maps['currencies'][strtolower($currency->code)] = $currency->id; } $vendors = $this->vendorRepo->all(); foreach ($vendors as $vendor) { $this->addVendorToMaps($vendor); } $expenseCaegories = $this->expenseCategoryRepo->all(); foreach ($expenseCaegories as $category) { $this->addExpenseCategoryToMaps($category); } }