feat: Reimplement order and invoice management with new service and repository layers, introduce compression middleware, and update database schema.
This commit is contained in:
@@ -54,4 +54,12 @@ class OrderCachedRepository extends BaseCachedRepository implements OrderReposit
|
||||
$this->clearCache();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function findByOrderNum(string $orderNum)
|
||||
{
|
||||
$cacheKey = $this->getCacheKey(md5(json_encode(['findByOrderNum' => $orderNum])));
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($orderNum) {
|
||||
return $this->orderRepository->findByOrderNum($orderNum);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,4 +133,17 @@ class OrderRepository extends BaseRepository implements OrderRepositoryInterface
|
||||
}
|
||||
return $this->model->where($key, $value)->update($data);
|
||||
}
|
||||
|
||||
public function findByOrderNum(string $orderNum)
|
||||
{
|
||||
return Order::with([
|
||||
'orderItems.product',
|
||||
'orderItems.os',
|
||||
'user',
|
||||
'customer',
|
||||
'payment',
|
||||
'discount',
|
||||
'invoice',
|
||||
])->where('order_num', $orderNum)->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@ interface OrderRepositoryInterface extends BaseRepositoryInterface{
|
||||
public function filter(array $data = [],array $relationships = [],array $withCount = [],array $select = ['*'], bool $returnQuery = false);
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [],array $withCount = [], array $withSum = []);
|
||||
public function updateBy(string $key = '',string|int $value = '',array $data =[]);
|
||||
public function findByOrderNum(string $orderNum);
|
||||
}
|
||||
Reference in New Issue
Block a user