SHARE
TWEET

Untitled

a guest Jun 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $product = Product::select('product_price')
  2.                         ->get();
  3.  
  4.         foreach ($product as $value) {
  5.  
  6.             if($value->product_price == 1000){
  7.  
  8.                   $prod1 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
  9.                     ->select('company.name', 'company.logo', 'timeline_product.company_id', 'timeline_product.product_name', 'timeline_product.product_desc', 'timeline_product.product_price','timeline_product.reward_points' ,'timeline_product.created_at', 'timeline_product.updated_at')
  10.                     ->where('timeline_product.product_price','<=',1000)
  11.                     ->orderBy('timeline_product.updated_at', 'desc')
  12.                     ->limit($limit)
  13.                     ->offset($offset)
  14.                     ->get();
  15.  
  16.                    // $post = array('result' => $prod1);
  17.  
  18.             }elseif ($value->product_price == 2000) {
  19.  
  20.                     $prod2 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
  21.                     ->select('company.name', 'company.logo', 'timeline_product.company_id', 'timeline_product.product_name', 'timeline_product.product_desc', 'timeline_product.product_price','timeline_product.reward_points' ,'timeline_product.created_at', 'timeline_product.updated_at')
  22.                     ->whereBetween('timeline_product.product_price', [1000, 2000])
  23.                     ->orderBy('timeline_product.updated_at', 'desc')
  24.                     ->limit($limit)
  25.                     ->offset($offset)
  26.                     ->get();
  27.  
  28.                   // $post = array('result' => $prod2);
  29.  
  30.             }elseif ($value->product_price == 3000) {
  31.  
  32.                      $prod3 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
  33.                     ->select('company.name', 'company.logo', 'timeline_product.company_id', 'timeline_product.product_name', 'timeline_product.product_desc', 'timeline_product.product_price','timeline_product.reward_points' ,'timeline_product.created_at', 'timeline_product.updated_at')
  34.                     ->whereBetween('timeline_product.product_price', [2000, 3000])
  35.                     ->orderBy('timeline_product.updated_at', 'desc')
  36.                     ->limit($limit)
  37.                     ->offset($offset)
  38.                     ->get();
  39.                   // $post = array('result' => $prod3);
  40.  
  41.             }elseif ($value->product_price == 4000) {
  42.  
  43.                      $prod4 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
  44.                     ->select('company.name', 'company.logo', 'timeline_product.company_id', 'timeline_product.product_name', 'timeline_product.product_desc', 'timeline_product.product_price','timeline_product.reward_points' ,'timeline_product.created_at', 'timeline_product.updated_at')
  45.                     ->whereBetween('timeline_product.product_price', [3000, 4000])
  46.                     ->orderBy('timeline_product.updated_at', 'desc')
  47.                     ->limit($limit)
  48.                     ->offset($offset)
  49.                     ->get();
  50.  
  51.                   // $post = array('result' => $prod4);
  52.  
  53.             }
  54.  
  55.         // array_push($product,$post);
  56.  
  57.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top