<?php

namespace Hilco\Models;

/**
 * @deprecated
 */
class AdditionalTaxCustomerSegment extends WebModel {
    protected $table = 'AdditionalTax_CustomerSegment';

    public function customerSegments()
    {
        return $this->belongsTo(CustomerSegment::class, 'customersegment_id');
    }

    public function additionalTax() {
        return $this->hasMany(AdditionalTax::class, 'tax_code', 'tax_code')
            ->where('deleted_at', '0000-00-00 00:00:00')
            ->where('effective_date', '<=', date('Y-m-d', time()))
            ->where(function ($query) {
                return $query->where('expiration_date', '>=', date('Y-m-d', time()))
                    ->orWhere('expiration_date', '0000-00-00');
            });
    }
}
