fixed #563
This commit is contained in:
parent
0abf3eae57
commit
bbec3dafc2
@ -31,11 +31,12 @@ class Transactions extends Controller
|
|||||||
$types = collect(['expense' => 'Expense', 'income' => 'Income'])
|
$types = collect(['expense' => 'Expense', 'income' => 'Income'])
|
||||||
->prepend(trans('general.all_type', ['type' => trans_choice('general.types', 2)]), '');
|
->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 = $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') {
|
if ($type != 'income') {
|
||||||
$this->addTransactions(Payment::collect(['paid_at'=> 'desc']), trans_choice('general.expenses', 1));
|
$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));
|
$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)
|
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