<?php
namespace App\Models\Amazon;

use Illuminate\Database\Eloquent\Model;
use DB;

class Azorderlineitem extends Model
{
    protected $dates = [''];
    protected $table = 'az_order_line_items';
    protected $connection = 'amazon';
    protected $rules = array(
        
    );
    protected $injectUniqueIdentifier = true;



   public static function fetchOrderSingleData($column , $value,$az_order_id='')
   {

      $orderObj = Azorderlineitem::where($column,$value)->where("az_order_id",$az_order_id)->whereNull('deleted_at')->first();
      return $orderObj;
   }


   public static function getLineItemsOfItemDB($az_order_id){
      $orderlineitemObj = Azorderlineitem::where("az_order_id",$az_order_id)->whereNull('deleted_at')->get();
      return $orderlineitemObj;
   }

   public static function AzordergetLineItemsByOrder($seller_id, $AmazonOrderId, $az_order_id){
      $orderlineitemObj = Azorderlineitem::where("AmazonOrderId",$AmazonOrderId)->where('seller_id', $seller_id)->where('az_order_id', $az_order_id)->whereNull('deleted_at')->get();
      if(!empty($orderlineitemObj))
        $orderlineitemObj = $orderlineitemObj->toArray();
      return $orderlineitemObj;
   }

}
