Ejemplo n.º 1
0
 public static function display($productId)
 {
     $discount = Discounts::whereStatus('active')->whereProductId($productId)->first();
     if ($discount) {
         return $discount->discount_type == 'percentage' ? $discount->amount . '%' : $discount->amount;
     } else {
         return null;
     }
 }