/** * Add or Edit Form */ public function invoiceProfile($invoice_id) { // Validation Rules $validator = Validator::make(['invoice_id' => $invoice_id], ['invoice_id' => 'integer']); // If Validation Fails if ($validator->fails()) { return redirect('/customers')->withErrors($validator->messages()->toArray()); } // Get the invoice model $invoice = new Invoice($invoice_id); // Invoice Items as an array $items = $invoice->getItems(); // All Items Collection $all_items = Item::all(); // Return the Invoice Profile View return view('invoices.profile', ['invoice' => $invoice, 'items' => $items->getArray(), 'all_items' => $all_items->getArray()]); }