mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add some custom order.
This commit is contained in:
parent
9a4a2708c0
commit
8dd315d7d6
@ -61,7 +61,7 @@ class AccountController extends Controller
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
$this->balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, ];
|
||||
$this->balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE,];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,6 +104,16 @@ class AccountController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
// custom order.
|
||||
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
|
||||
|
||||
|
||||
usort($return, function ($a, $b) use ($order) {
|
||||
$pos_a = array_search($a['type'], $order);
|
||||
$pos_b = array_search($b['type'], $order);
|
||||
return $pos_a - $pos_b;
|
||||
});
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user