<?php

namespace Modules\Coupon\Models;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\Product\Models\Product;
use Modules\User\Models\User;

class Coupon extends Model
{
    //use soft delete
    use SoftDeletes;

    protected $fillable = [
        'code','start_date','end_date','status_discount','discount','count','user_count','user_id'
    ];

    public function user()
    {
        return $this->belongsTo(User::class)->withTrashed();
    }
    public function currentDescription() :HasOne
    {
        return $this->hasOne(CouponDescription::class)->where('language_id', currentLanguage()->id);
    }

}
