<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

use App\Traits\ModelLogChanging;

class OrderIssueRejectedBill extends Model
{
    use ModelLogChanging;
    protected $table='order_issue_rejected_bill';
    public $timestamps = false;
    protected $fillable = [
        'order_issue_id','logistic_number_return'
    ];

    public function orderIssue()
    {
        return $this->belongsTo(OrderIssue::class,'order_issue_id','id');
    }

    public function rejectedBill()
    {
        return $this->belongsTo(RejectedBill::class,'logistic_number_return','logistic_number_return');
    }

    public static function isExit($order_issue_id,$logistic_number_return)
    {
        return OrderIssueRejectedBill::query()->where('order_issue_id',$order_issue_id)->where('logistic_number_return',$logistic_number_return)->exists();
    }
}
