|
|
@@ -6,6 +6,7 @@ namespace App\Filters;
|
|
|
use App\Order;
|
|
|
use App\Services\UserService;
|
|
|
use Illuminate\Http\Request;
|
|
|
+use Illuminate\Support\Str;
|
|
|
use phpDocumentor\Reflection\Types\Boolean;
|
|
|
|
|
|
class OrderPackageFilters
|
|
|
@@ -13,7 +14,7 @@ class OrderPackageFilters
|
|
|
protected $request;
|
|
|
protected $queryBuilder;
|
|
|
protected $filters = ['logistic_number', 'status', 'received_at_start',
|
|
|
- 'received_at_end', 'is_weighed', 'logistic_id', 'owner_id', 'sent_at_start', 'sent_at_end', 'is_exception','exception_type','default_date'];
|
|
|
+ 'received_at_end', 'is_weighed', 'logistic_id', 'owner_id', 'sent_at_start', 'sent_at_end', 'is_exception', 'exception_type', 'default_date'];
|
|
|
|
|
|
public function __construct(Request $request)
|
|
|
{
|
|
|
@@ -35,8 +36,9 @@ class OrderPackageFilters
|
|
|
|
|
|
private function logistic_number($logistic_number)
|
|
|
{
|
|
|
- $this->queryBuilder->where('logistic_number', $logistic_number);
|
|
|
+ $this->queryBuilder->whereIn('logistic_number', explode(",", $logistic_number));
|
|
|
}
|
|
|
+
|
|
|
private function exception_type($exception_type)
|
|
|
{
|
|
|
$this->queryBuilder->where('exception_type', $exception_type);
|
|
|
@@ -69,8 +71,8 @@ class OrderPackageFilters
|
|
|
private function logistic_id($logistic_id)
|
|
|
{
|
|
|
$logistic_ids = array_filter(preg_split('/[,, ]+/is', $logistic_id));
|
|
|
- $this->queryBuilder->whereIn('order_id',function($query)use($logistic_ids){
|
|
|
- $query->from('orders')->select('id')->whereIn('logistic_id',$logistic_ids);
|
|
|
+ $this->queryBuilder->whereIn('order_id', function ($query) use ($logistic_ids) {
|
|
|
+ $query->from('orders')->select('id')->whereIn('logistic_id', $logistic_ids);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -97,6 +99,6 @@ class OrderPackageFilters
|
|
|
|
|
|
public function default_date()
|
|
|
{
|
|
|
- $this->queryBuilder->where('sent_at', '>=',now()->startOfDay() ->subDays(15))->where('sent_at', '<',now()->startOfDay()->addDay());
|
|
|
+ $this->queryBuilder->where('sent_at', '>=', now()->startOfDay()->subDays(15))->where('sent_at', '<', now()->startOfDay()->addDay());
|
|
|
}
|
|
|
}
|