Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $product = Product::select('product_price')
- ->get();
- foreach ($product as $value) {
- if($value->product_price == 1000){
- $prod1 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
- ->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')
- ->where('timeline_product.product_price','<=',1000)
- ->orderBy('timeline_product.updated_at', 'desc')
- ->limit($limit)
- ->offset($offset)
- ->get();
- // $post = array('result' => $prod1);
- }elseif ($value->product_price == 2000) {
- $prod2 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
- ->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')
- ->whereBetween('timeline_product.product_price', [1000, 2000])
- ->orderBy('timeline_product.updated_at', 'desc')
- ->limit($limit)
- ->offset($offset)
- ->get();
- // $post = array('result' => $prod2);
- }elseif ($value->product_price == 3000) {
- $prod3 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
- ->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')
- ->whereBetween('timeline_product.product_price', [2000, 3000])
- ->orderBy('timeline_product.updated_at', 'desc')
- ->limit($limit)
- ->offset($offset)
- ->get();
- // $post = array('result' => $prod3);
- }elseif ($value->product_price == 4000) {
- $prod4 = Product::join('company', 'timeline_product.company_id', '=', 'company.company_id')
- ->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')
- ->whereBetween('timeline_product.product_price', [3000, 4000])
- ->orderBy('timeline_product.updated_at', 'desc')
- ->limit($limit)
- ->offset($offset)
- ->get();
- // $post = array('result' => $prod4);
- }
- // array_push($product,$post);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement