wip
This commit is contained in:
51
app/Models/Ecommerce/Product/Coupon/Coupon.php
Normal file
51
app/Models/Ecommerce/Product/Coupon/Coupon.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ecommerce\Product\Coupon;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Coupon extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* Discount by percentage (%)
|
||||
*/
|
||||
public const DISCOUNT_PERCENTAGE = 'percentage';
|
||||
|
||||
/**
|
||||
* Discount by fixed amount (ex: -10 TMT)
|
||||
*/
|
||||
public const DISCOUNT_FIXED = 'fixed_amount';
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'discount_type',
|
||||
'discount_value',
|
||||
'notes',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* Discount types
|
||||
*/
|
||||
public static function discountTypes(): array
|
||||
{
|
||||
return [
|
||||
self::DISCOUNT_PERCENTAGE => __('Percentage'),
|
||||
self::DISCOUNT_FIXED => __('Fixed Amount'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Default discount type
|
||||
*/
|
||||
public static function defaultDiscountType(): string
|
||||
{
|
||||
return self::DISCOUNT_PERCENTAGE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user