mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 14:40:44 +00:00
76 lines
1.7 KiB
PHP
76 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filters;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
class GoodsSkuFilter extends Filters
|
|
{
|
|
protected function skuTitle($value)
|
|
{
|
|
return $this->builder->where('title', 'like', '%' . $value . '%');
|
|
}
|
|
|
|
protected function status($value)
|
|
{
|
|
return $this->builder->where('status', $value);
|
|
}
|
|
|
|
protected function excludeIds($value)
|
|
{
|
|
return $this->builder->whereNotIn('id', $value);
|
|
}
|
|
|
|
protected function externalSkuId($value)
|
|
{
|
|
return $this->builder->where('external_sku_id', $value);
|
|
}
|
|
|
|
protected function isCombination($value)
|
|
{
|
|
return $this->builder->where('is_combination', $value);
|
|
}
|
|
|
|
protected function createTimeStart($value)
|
|
{
|
|
|
|
return $this->builder->where('created_at', ">=", $value);
|
|
}
|
|
|
|
protected function createTimeEnd($value)
|
|
{
|
|
$end = Carbon::parse($value)->endOfDay()->toDateTimeString();
|
|
return $this->builder->where('created_at', "<=", $end);
|
|
}
|
|
|
|
protected function minStock($value)
|
|
{
|
|
return $this->builder->where('stock',">=", $value);
|
|
}
|
|
|
|
protected function maxStock($value)
|
|
{
|
|
return $this->builder->where('stock',"<=", $value);
|
|
}
|
|
|
|
protected function minSaleStock($value)
|
|
{
|
|
return $this->builder->where('sale_stock',">=", $value);
|
|
}
|
|
|
|
protected function maxSaleStock($value)
|
|
{
|
|
return $this->builder->where('sale_stock',"<=", $value);
|
|
}
|
|
|
|
protected function neqSaleStock($value)
|
|
{
|
|
return $this->builder->where('sale_stock',"!=", $value);
|
|
}
|
|
|
|
protected function neqStock($value)
|
|
{
|
|
return $this->builder->where('stock',"!=", $value);
|
|
}
|
|
}
|