<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class RequestForQuotation extends Model
{
    

    public static  function getVendorIds( $pr_id = null )
    {
        $response = 0;
        $purchase_request_items = PurchaseRequest::find($pr_id)
        ->item->pluck('item_id')->toArray();

        $vendor_lists = ItemVendor::whereIn('item_id' , $purchase_request_items )
        ->pluck('purchase_request_vendor_id')->toArray();

       return $vendor_lists;
    }


     public static  function getVendorTotalItems( $vendor_id = null , $pr_id = null )
    {
      
        $purchase_request_items = PurchaseRequest::find($pr_id)
        ->item->pluck('item_id')->toArray();

        $vendor_lists = ItemVendor::whereIn('item_id' , $purchase_request_items )
        ->where('purchase_request_vendor_id' , $vendor_id )->count();
       return $vendor_lists;
    }

}
