Add some custom order.

This commit is contained in:
James Cole
2020-08-02 18:25:09 +02:00
parent 9a4a2708c0
commit 8dd315d7d6

View File

@@ -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);
}
}