From 5bb221931fcb4010a3cbaf8c6b409b02103f096a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 20 Jan 2022 12:15:33 +1100 Subject: [PATCH] Charts for react --- app/Http/Controllers/ChartController.php | 76 ++++++++++++++++++++ app/Http/Requests/Chart/ShowChartRequest.php | 34 +++++++++ app/Services/Chart/ChartService.php | 48 +++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 app/Http/Controllers/ChartController.php create mode 100644 app/Http/Requests/Chart/ShowChartRequest.php create mode 100644 app/Services/Chart/ChartService.php diff --git a/app/Http/Controllers/ChartController.php b/app/Http/Controllers/ChartController.php new file mode 100644 index 000000000000..bc0b254f8c27 --- /dev/null +++ b/app/Http/Controllers/ChartController.php @@ -0,0 +1,76 @@ +json([],200); + } + +} diff --git a/app/Http/Requests/Chart/ShowChartRequest.php b/app/Http/Requests/Chart/ShowChartRequest.php new file mode 100644 index 000000000000..0c510f1940ec --- /dev/null +++ b/app/Http/Requests/Chart/ShowChartRequest.php @@ -0,0 +1,34 @@ +user()->isAdmin(); + } + + public function rules() + { + return [ + ]; + } +} diff --git a/app/Services/Chart/ChartService.php b/app/Services/Chart/ChartService.php new file mode 100644 index 000000000000..f1cc714eec3b --- /dev/null +++ b/app/Services/Chart/ChartService.php @@ -0,0 +1,48 @@ +company = $company; + } + + public function getCurrencyCodes() + { + + $currencies = Payment::withTrashed() + ->where('company_id', $this->company->id) + ->where('is_deleted', 0) + ->distinct() + ->get(['currency_id']); + + $expense_currencies = Expense::withTrashed() + ->where('company_id', $this->company->id) + ->where('is_deleted', 0) + ->distinct() + ->get(['expense_currency_id']); + + + $currencies = $currencies->merge($expense_currencies)->unique(); + + + } + +}