From a64138292c99181d2889311bf2102c5598a6263c Mon Sep 17 00:00:00 2001 From: Ritikesh yadav Date: Tue, 25 Jun 2024 11:36:51 +0530 Subject: [PATCH] added images to top pick products --- app/Http/Controllers/Frontend/HomeController.php | 2 +- app/Models/Product.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Frontend/HomeController.php b/app/Http/Controllers/Frontend/HomeController.php index b2ab94b..0afcfb6 100644 --- a/app/Http/Controllers/Frontend/HomeController.php +++ b/app/Http/Controllers/Frontend/HomeController.php @@ -30,7 +30,7 @@ class HomeController extends Controller { public function index() { - // dd($this->getAllTopPickProducts()); + // dd($this->getAllTopPickProducts()['data']->toArray()); return view('Frontend.Pages.index', [ 'topPicks' => $this->getAllTopPickProducts(), 'testimonial' => Testimonial::where('is_active',true)->get(), diff --git a/app/Models/Product.php b/app/Models/Product.php index db0d9f8..7232f8b 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -411,7 +411,11 @@ class Product extends Model { $equitiesStockExchangeRealEstateRoute = 'https://jerichoalternatives.in/api/equities-stock-real-estate-single-data/'; - $products = $query->select(\DB::raw('products.id,products.description,coalesce(fre.property_name_and_location,aif.fund_name,bd.issuer,fd.fund_name,exchange.name,re.property_name) as product_name'), 'products.categories_id as categories_id', 'categories.category_name', 'top_pick', 'fre.property_image', 'company_logo', 'file_name', \DB::raw('coalesce(fre.geographic_focus,aif.geographic_focus,bd.geographic_focus,fd.geographic_focus,exchange.geographic_focus,re.geographic_focus) as geographic_focus'), \DB::raw('coalesce(fre.minimum_investment,aif.minimum_investment,bd.minimum_investment,fd.minimum_investment,re.total_price) as minimum_investment'), \DB::raw('coalesce(fre.slug,aif.slug,bd.slug,fd.slug,re.slug,exchange.slug) as slug'), + $products = $query->select(\DB::raw('products.id,products.description,coalesce(fre.property_name_and_location,aif.fund_name,bd.issuer,fd.fund_name,exchange.name,re.property_name) as product_name'), + 'products.categories_id as categories_id', 'categories.category_name', 'top_pick', 'fre.property_image','companies.id as company_id', 'company_logo', 'file_name', + \DB::raw('coalesce(fre.geographic_focus,aif.geographic_focus,bd.geographic_focus,fd.geographic_focus,exchange.geographic_focus,re.geographic_focus) as geographic_focus'), + \DB::raw('coalesce(fre.minimum_investment,aif.minimum_investment,bd.minimum_investment,fd.minimum_investment,re.total_price) as minimum_investment'), + \DB::raw('coalesce(fre.slug,aif.slug,bd.slug,fd.slug,re.slug,exchange.slug) as slug'), // \DB::raw('coalesce(fre.property_description,aif.description,bd.about_issuer,fd.fund_description,exchange.about,re.remarks) as description') // \DB::raw('coalesce(products.description) as description') // 'products.description' @@ -422,7 +426,11 @@ class Product extends Model ->leftJoin('funds as fd', 'products.id', 'fd.products_id') ->leftJoin('stock_funds_real_estate_exchanges as exchange', 'products.id', 'exchange.products_id') ->leftJoin('real_estates as re', 'products.id', 're.products_id') - ->leftJoin('companies', 'aif.companies_id', 'companies.id') + ->leftJoin('companies', function($query){ + $query->on('aif.companies_id', 'companies.id'); + $query->orOn('fd.platform_partner', 'companies.id'); + $query->orOn('re.platform_partner', 'companies.id'); + }) ->leftJoin('product_photo_documents as ppd', function ($query) { $query->on('re.id', 'ppd.real_estates_id') ->where('ppd.type', 0);