From bcd29b93e1937788939ad3bb3e45b0a26892071b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 24 Aug 2021 15:31:40 +0200 Subject: [PATCH] CreateStatementRequest.php --- .../Statements/CreateStatementRequest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/app/Http/Requests/Statements/CreateStatementRequest.php b/app/Http/Requests/Statements/CreateStatementRequest.php index ac0f1a205e1f..a8577c538367 100644 --- a/app/Http/Requests/Statements/CreateStatementRequest.php +++ b/app/Http/Requests/Statements/CreateStatementRequest.php @@ -2,6 +2,8 @@ namespace App\Http\Requests\Statements; +use App\Models\Invoice; +use App\Models\Payment; use Illuminate\Foundation\Http\FormRequest; class CreateStatementRequest extends FormRequest @@ -28,4 +30,42 @@ class CreateStatementRequest extends FormRequest 'end_date' => ['required'], ]; } + + /** + * The collection of invoices for the statement. + * + * @return Invoice[]|\Illuminate\Database\Eloquent\Collection + */ + public function getInvoices() + { + // $this->request->start_date & $this->request->end_date are available. + + return Invoice::all(); + } + + /** + * The collection of payments for the statement. + * + * @return Payment[]|\Illuminate\Database\Eloquent\Collection + */ + public function getPayments() + { + // $this->request->start_date & $this->request->end_date are available. + + return Payment::all(); + } + + /** + * The array of aging data. + */ + public function getAging(): array + { + return [ + '0-30' => 1000, + '30-60' => 2000, + '60-90' => 3000, + '90-120' => 4000, + '120+' => 5000, + ]; + } }