fixing bid issue

This commit is contained in:
Ritikesh yadav
2024-05-16 11:53:28 +05:30
parent 8889b612de
commit 5a6f82f8a3
4 changed files with 32 additions and 21 deletions

View File

@@ -117,14 +117,15 @@ class MarketPlaceController extends Controller
// dd('helo');
// dd($request->all());
$offering = $this->viewOfferingData($slug);
// dd($offering['data']->id);
// dd($offering);
// $status = MarketplaceBuyerForm::where(['associated_id'=>$offering['data']->id,'status'=>'Sold'])->exists() ? 'SOLD':'OPEN';
$status = '';
$checkBIDExist = MarketplaceBuyerForm::where('associated_id', $offering['data']->id)->where('status', 'Sold')->exists();
$checkBIDExist = MarketplaceBuyerForm::where('associated_id', $offering['data']->id)->where('status', 'Sold')->get();
// dd($checkBIDExist);
if ($checkBIDExist) {
$buyerData = MarketplaceBuyerForm::where('associated_id', $offering['data']->id)->where('status', 'Sold')->get();
// dd($buyerData->toArray());
if (MarketplaceAlternativeInvestmentFundSeller::where('id', $buyerData[0]->associated_id)->exists()) {
// dd($buyerData[0]->associated_id);
if (MarketplaceAlternativeInvestmentFundSeller::where('id', $buyerData[0]->associated_id)->exists() && $offering['type'] == 'alternative-investment-funds') {
$totalSellUnits = 0;
$buyerData->each(function ($data) use ($totalSellUnits) {
return $totalSellUnits += (int)$data->no_of_units_you_wish_to_buy;
@@ -134,15 +135,18 @@ class MarketPlaceController extends Controller
$remainUnits = $aifData - $totalSellUnits;
if ($remainUnits <= 0) {
$status .= 'SOLD';
}else{
$status .= 'OPEN';
}
$status .= 'OPEN';
} elseif (MarketplaceFractionalRealEstateSeller::where('id', $buyerData[0]->associated_id)->exists()) {
} elseif (MarketplaceFractionalRealEstateSeller::where('id', $buyerData[0]->associated_id)->exists() && $offering['type'] == 'fractional-real-estate') {
$freData = MarketplaceFractionalRealEstateSeller::where('id', $buyerData[0]->associated_id)->first();
if($freData->current_market_value_of_the_property <= 0)
{
$status .= 'SOLD';
}
$status .= 'OPEN';
else{
$status .= 'OPEN';
}
}
} else {
$status .= 'OPEN';
@@ -155,6 +159,7 @@ class MarketPlaceController extends Controller
$type = $offering['type'];
$ownProduct = $offering['own-product'];
$logged_in = auth()->guard('users')->check() == true ? true : false;
// dd($status);
// dd('offering',$offering['invested_data']);
$investedData = $offering['invested_data'];