Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

Check Exits product for applied flash amount

  public function flash_amount($productId)

    {
        $data['product_promotion'] = Offer::where('started_date','<=',Carbon::now())->where('end_date','>=',Carbon::now())->with('product_promotion')->first();
        if ($data['product_promotion']) {
            foreach($data['product_promotion']->product_promotion as $promotion){
                if($promotion->product_id == $productId){
                    $exist = 1;
                }
            }
            if($exist == 1){
                foreach($data['product_promotion']->product_promotion as $promotion){
                    if($promotion->product_id == $productId){
                        return $promotion->flash_amount;
                    }
                }
            }
            else{
                return null;
            }

        }
        else
        {
            return null;
        }
    }

Post a Comment

0 Comments

Ad Code

Responsive Advertisement