From ffe445d0f39a01f13ebe1c034b22c31708f8a2bf Mon Sep 17 00:00:00 2001 From: Sevan Nerse Date: Thu, 2 Jun 2022 00:50:48 +0300 Subject: [PATCH] scope added #2znd43c --- app/Http/Controllers/Banking/Transactions.php | 2 +- app/Models/Banking/Transaction.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Banking/Transactions.php b/app/Http/Controllers/Banking/Transactions.php index 6a672aeef..dee840e17 100644 --- a/app/Http/Controllers/Banking/Transactions.php +++ b/app/Http/Controllers/Banking/Transactions.php @@ -35,7 +35,7 @@ class Transactions extends Controller */ public function index() { - $transactions = Transaction::with('account', 'category', 'contact')->isNotRecurring()->collect(['paid_at'=> 'desc']); + $transactions = Transaction::with('account', 'category', 'contact')->isNotRecurring()->isNotSplit()->collect(['paid_at'=> 'desc']); $totals = [ 'income' => 0, diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php index 757a851d4..f658859f6 100644 --- a/app/Models/Banking/Transaction.php +++ b/app/Models/Banking/Transaction.php @@ -190,6 +190,16 @@ class Transaction extends Model return $query->where($this->qualifyColumn('type'), 'not like', '%-recurring'); } + public function scopeIsSplit(Builder $query): Builder + { + return $query->where($this->qualifyColumn('type'), 'like', '%-split'); + } + + public function scopeIsNotSplit(Builder $query): Builder + { + return $query->where($this->qualifyColumn('type'), 'not like', '%-split'); + } + public function scopeIsTransfer(Builder $query): Builder { return $query->where('category_id', '=', Category::transfer());