From a3b52a007721a47c39bef8aa180ac21b91b1d064 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Thu, 15 Jul 2021 21:19:08 +0200 Subject: [PATCH] Add whereNeedsBill and whereNeedsRemember Scopes --- app/Payment/Payment.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Payment/Payment.php b/app/Payment/Payment.php index 3b27ae88..a45c1dea 100644 --- a/app/Payment/Payment.php +++ b/app/Payment/Payment.php @@ -31,4 +31,16 @@ class Payment extends Model return $q->needsPayment(); }); } + + public function scopeWhereNeedsBill($q) { + return $q->whereHas('status', function($q) { + return $q->where('is_bill', true); + }); + } + + public function scopeWhereNeedsRemember($q) { + return $q->whereHas('status', function($q) { + return $q->where('is_remember', true); + }); + } }