<?php
namespace App\Models\Amazon;

use App\Helpers\Helper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\User;
use Auth;
use DB;

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

    public static function getLastSync($seller_id='',$sync_type = 'Order',$seller_marketplace_id = '')
   {
      $orderObj = Azlastsync::where("seller_id",$seller_id)->where('sync_type',$sync_type);

      if($seller_marketplace_id != '')
      $orderObj = $orderObj->where('seller_marketplace_id',$seller_marketplace_id);

      $orderObj = $orderObj->first();
      return $orderObj;
   }
}