function getStatus($field, $value) { $statuses = statuses(); foreach ($statuses as $key => $status) { if ($status[$field] === $value) { return $key; } } return false; }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $invoice = $this->invoice->with('items')->getById($id); if ($invoice) { $products = $this->product->productSelect(); $clients = $this->client->clientSelect(); $taxes = $this->tax->taxSelect(); $currencies = $this->currency->currencySelect(); $statuses = statuses(); $invoice->totals = $this->invoice->invoiceTotals($id); return view('invoices.edit', compact('invoice', 'clients', 'products', 'taxes', 'currencies', 'statuses')); } return redirect('invoices'); }