where([ 'users_id' => auth()->guard('users')->user()->id ?? request()->user()->id, 'table' => 'marketplace_aif_sellers', ]); } public function scopeFractionalRealEstate($query) { return $query->where([ 'users_id' => auth()->guard('users')->user()->id ?? request()->user()->id, 'table' => 'marketplace_fre_sellers', ]); } public function scopeOtherProducts($query) { return $query->where([ 'users_id' => auth()->guard('users')->user()->id ?? request()->user()->id, 'table' => 'marketplace_op_sellers', ]); } public function scopeSold($query) { return $query->where('marketplace_buyer_forms.status', 'Sold'); } public function getFundCategoryAttribute($value){ // return 123; return $this->attributes['name_of_the_aif_fund']; // return $this->get_money_format($value); } public function getOfferPricePerUnitAttribute($value) { return $this->IND_money_format($value) ; } public function getTotalPurchaseValueAttribute($value) { return $this->IND_money_format($value) ; } public 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 company(){ return $this->belongsTo(Company::class,'platform'); } public function freSellerData(){ return $this->hasOne(MarketplaceFractionalRealEstateSeller::class,'id','associated_id'); } public function aifSellerData(){ return $this->hasOne(MarketplaceAlternativeInvestmentFundSeller::class,'id','associated_id'); } // public function compaines() // { // return $this->belongsTo(Company::class,'platform'); // } }