mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 16:40:10 +00:00
Add some custom order.
This commit is contained in:
@@ -61,7 +61,7 @@ class AccountController extends Controller
|
|||||||
return $next($request);
|
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);
|
return response()->json($return);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user