<?php
/**
 * Created by PhpStorm.
 * User: brian
 * Date: 2/3/20
 * Time: 11:31 AM
 */

namespace Hilco\Models;


class DeliveryMethodTerm extends WebModel
{
    protected $table = "DeliveryMethod_DeliveryTerm";

    public function scopeCodes($query, $codes) {
        return $query->whereIn('delivery_method_code', $codes);
    }

    public static function delivery($method, $term, $priority){
        return DeliveryMethodTerm::where("deliverymethod_id", '=', $method)->where('deliveryterm_id', '=', $term)
            ->where('def_delivery_priority', '=', $priority)->where('deleted_at', '=', '0000-00-00 00:00:00')->first();
    }
}