public function sanitize() { $input = $this->all(); if ($this->expense_category_id) { $input['expense_category_id'] = ExpenseCategory::getPrivateId($this->expense_category_id); $this->replace($input); } return $this->all(); }
public function save($input, $category = false) { $publicId = isset($data['public_id']) ? $data['public_id'] : false; if (!$category) { $category = ExpenseCategory::createNew(); } $category->fill($input); $category->save(); return $category; }
private static function getViewModel() { return ['data' => Input::old('data'), 'account' => Auth::user()->account, 'sizes' => Cache::get('sizes'), 'paymentTerms' => Cache::get('paymentTerms'), 'industries' => Cache::get('industries'), 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), 'countries' => Cache::get('countries'), 'customLabel1' => Auth::user()->account->custom_vendor_label1, 'customLabel2' => Auth::user()->account->custom_vendor_label2, 'categories' => ExpenseCategory::whereAccountId(Auth::user()->account_id)->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get()]; }