The Asset Management feature provides insights into the platform's assets. Key components include:
On page load, the /api:BVaDN9hl/asset_management/get and /api:BVaDN9hl/asset_management/stats endpoints which run App\Http\Controllers\Admin\AssetManagementController@get and App\Http\Controllers\Admin\AssetManagementController@stats respectively.
public function get()
{
$assetClass = DB::table('investment_pools')
->select('id', 'name')
->get();
$assetType = DB::table('investment_pool_asset_types')
->select('id', 'name')
->get();
return RespondWithSuccess::run(...[
'body' => [
'class' => $assetClass,
'type' => $assetType,
]
]);
}
The snippet above retrieves the asset classes and types from the database.
{
"class": [
{
"id": 1,
"name": "Short Term Pool"
},
{
"id": 2,
"name": "Long Term Pool"
}
],
"type": [
{
"id": 1,
"name": "MMF"
},
{
"id": 2,
"name": "Bond"
},
{
"id": 3,
"name": "Equity"
},
{
"id": 4,
"name": "Treasury Bill"
}
]
}
public function stats()
{
$float = GetFloatBalanceAction::run();
$ltp = GetInvestmentPoolAssetsAction::run(2);
$ltp_array = collect();
foreach ($ltp as $l)
{
$l = (object) $l;
$investment_pool_asset_id = $l->id;
$asset_total = GetInvestmentPoolAssetValueAction::run($investment_pool_asset_id);
$data = [
'name' => $l->name,
'id' => $l->id,
'amount' => number_format($asset_total, 2)
];
$ltp_array->push($data);
}
$stp = GetInvestmentPoolAssetsAction::run(1);
$stp_array = collect();
foreach ($stp as $s)
{
$s = (object) $s;
$investment_pool_asset_id = $s->id;
$asset_total = GetInvestmentPoolAssetValueAction::run($investment_pool_asset_id);
$data = [
'name' => $s->name,
'id' => $s->id,
'amount' => number_format($asset_total, 2)
];
$stp_array->push($data);
}
$deposits_ltp = GetInvestmentPoolTotalDepositAction::run(2);
$investments_ltp = GetInvestmentPoolTotalInvestmentAction::run(2);
$deposits_stp = GetInvestmentPoolTotalDepositAction::run(1);
$investments_stp = GetInvestmentPoolTotalInvestmentAction::run(1);
$pool_amounts = [
'unallocated_ltp' => number_format(intval($deposits_ltp) - intval($investments_ltp), 2),
'unallocated_stp' => number_format(intval($deposits_stp) - intval($investments_stp), 2),
];
return RespondWithSuccess::run(...[
'body' => [
'float' => number_format($float, 2),
'stp' => $stp_array,
'ltp' => $ltp_array,
'pool_amounts' => $pool_amounts,
],
]);
}
This snippet retrieves the float amount, long-term pool assets, short-term pool assets, and pool amounts from the database by calling various actions, which include:
GetFloatBalanceAction::run()GetInvestmentPoolAssetsAction::run()GetInvestmentPoolAssetValueAction::run()GetInvestmentPoolTotalDepositAction::run()GetInvestmentPoolTotalInvestmentAction::run(){
"float": "15,000.00",
"stp": [
{
"name": "Sanlam MMF",
"id": 3,
"amount": "11,473,347.34"
}
],
"ltp": [
{
"name": "IFB1 2023/7",
"id": 8,
"amount": "11,035,352.82"
},
{
"name": "IFB 1 02",
"id": 6,
"amount": "0.00"
},
{
"name": "IFB 1 01",
"id": 5,
"amount": "11,041,420.19"
}
],
"pool_amounts": {
"unallocated_ltp": "17,131,178.00",
"unallocated_stp": "500,042.00"
}
}
The Float Amount section displays the current float amount available. The float amount is the total amount of money available for investment.
The Long Term Pool Assets section displays assets allocated to the long-term pool.
The Short Term Pool Assets section displays assets allocated to the short-term pool.
The Add Asset section allows financial admins to add new assets to the platform. Click the "Add Asset" button to add a new asset. The form includes the following fields:
Filling out the form and submitting it will add the asset to the platform by calling the /api:BVaDN9hl/asset_management/create/asset endpoint.