belongsTo(MonthlyUpdateMaster::class, 'monthly_id'); } public function getTotalInvestmentOrCommitmentAmountAttribute($value) { return $this->IND_money_format($value); } public function getGrossCommissionedEarnedInrAttribute($value) { return $this->IND_money_format($value); } public function getNetCommissionReceivedAttribute($value) { return $this->IND_money_format($value); } function IND_money_format($number) { $decimal = (string)($number - floor($number)); $money = floor($number); $length = strlen($money); $delimiter = ''; $money = strrev($money); for ($i = 0; $i < $length; $i++) { if (($i == 3 || ($i > 3 && ($i - 1) % 2 == 0)) && $i != $length) { $delimiter .= ','; } $delimiter .= $money[$i]; } $result = strrev($delimiter); $decimal = preg_replace("/0\./i", ".", $decimal); $decimal = substr($decimal, 0, 3); if ($decimal != '0') { $result = $result . $decimal; } return '₹ ' . $result; } public function products() { return $this->belongsTo(Product::class, 'products_id'); } }