70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class MonthlyUpdateFractionalRealEstate extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = ['custom_id','total_value_of_the_property','investment_value','investment_date','total_gross_interest','tds','total_net_interest','gross_entry_yield_in_pct','target_return_in_pct','absolute_return_till_date','absolute_return_till_date_in_pct','statement_reports','status'];
|
||
|
|
|
||
|
|
// const path = 'https://jerichoalternatives.in/api/get-statement-report/';
|
||
|
|
|
||
|
|
public function getStatementReportsAttribute($value)
|
||
|
|
{
|
||
|
|
if($value){
|
||
|
|
$arr = [];
|
||
|
|
foreach(json_decode($value) as $data){
|
||
|
|
$val = imagePath('api/get-statement-report/') . $data;
|
||
|
|
array_push($arr,$val);
|
||
|
|
}
|
||
|
|
return $arr ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public function getTotalValueOfThePropertyAttribute($value)
|
||
|
|
{
|
||
|
|
return $this->IND_money_format($value) ;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getInvestmentValueAttribute($value)
|
||
|
|
{
|
||
|
|
return $this->IND_money_format($value) ;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getAbsoluteReturnTillDateAttribute($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;
|
||
|
|
}
|
||
|
|
}
|