scope added #2znd43c

This commit is contained in:
Sevan Nerse 2022-06-02 00:50:48 +03:00
parent c9cc1fed89
commit ffe445d0f3
2 changed files with 11 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class Transactions extends Controller
*/ */
public function index() 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 = [ $totals = [
'income' => 0, 'income' => 0,

View File

@ -190,6 +190,16 @@ class Transaction extends Model
return $query->where($this->qualifyColumn('type'), 'not like', '%-recurring'); 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 public function scopeIsTransfer(Builder $query): Builder
{ {
return $query->where('category_id', '=', Category::transfer()); return $query->where('category_id', '=', Category::transfer());