fixed #563
This commit is contained in:
parent
0abf3eae57
commit
bbec3dafc2
@ -30,12 +30,13 @@ class Transactions extends Controller
|
||||
|
||||
$types = collect(['expense' => 'Expense', 'income' => 'Income'])
|
||||
->prepend(trans('general.all_type', ['type' => trans_choice('general.types', 2)]), '');
|
||||
|
||||
$categories = collect(Category::enabled()->type('income')->pluck('name', 'id'))
|
||||
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
|
||||
|
||||
$type = $request->get('type');
|
||||
|
||||
$type_cats = empty($type) ? ['income', 'expense'] : $type;
|
||||
$categories = collect(Category::enabled()->type($type_cats)->pluck('name', 'id'))
|
||||
->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), '');
|
||||
|
||||
if ($type != 'income') {
|
||||
$this->addTransactions(Payment::collect(['paid_at'=> 'desc']), trans_choice('general.expenses', 1));
|
||||
$this->addTransactions(BillPayment::collect(['paid_at'=> 'desc']), trans_choice('general.expenses', 1), trans_choice('general.bills', 1));
|
||||
|
@ -56,7 +56,7 @@ class Category extends Model
|
||||
*/
|
||||
public function scopeType($query, $type)
|
||||
{
|
||||
return $query->where('type', $type);
|
||||
return $query->whereIn('type', (array) $type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user