From 572b0d7d484710e3d36a0cc879e229461de7b615 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 23 Aug 2016 13:43:03 +0300 Subject: [PATCH] Fix for expense categories --- app/Http/Requests/ExpenseRequest.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Http/Requests/ExpenseRequest.php b/app/Http/Requests/ExpenseRequest.php index ae2e83b6d1..852df80f3c 100644 --- a/app/Http/Requests/ExpenseRequest.php +++ b/app/Http/Requests/ExpenseRequest.php @@ -1,5 +1,8 @@ relationLoaded('documents')) { $expense->load('documents'); } - + return $expense; } -} \ No newline at end of file + + 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(); + } +}