update console
This commit is contained in:
@@ -63,18 +63,18 @@ class InvoiceCachedRepository extends BaseCachedRepository implements InvoiceRep
|
||||
return $this->invoiceRepository->get_billing_day($day);
|
||||
});
|
||||
}
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [],array $withCount = [], array $withSum = [])
|
||||
public function findWithRelationships(string $ordernum = '', array $relationships = [], array $withCount = [], array $withSum = [])
|
||||
{
|
||||
$cacheKey = $this->getCacheKey(md5(json_encode([
|
||||
'findWithRelationships' => [
|
||||
'id' => $id,
|
||||
'ordernum' => $ordernum,
|
||||
'relationships' => $relationships,
|
||||
'withCount' => $withCount,
|
||||
'withSum' => $withSum
|
||||
]
|
||||
])));
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($id, $relationships,$withCount,$withSum) {
|
||||
return $this->invoiceRepository->findWithRelationships($id, $relationships,$withCount,$withSum);
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($ordernum, $relationships, $withCount, $withSum) {
|
||||
return $this->invoiceRepository->findWithRelationships($ordernum, $relationships, $withCount, $withSum);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class InvoiceRepository extends BaseRepository implements InvoiceRepositoryInter
|
||||
public function get_billing_day(int|string $day = ''){
|
||||
return $this->model->whereDate('created_at',$day)->get()->sum('total');
|
||||
}
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [], array $withCount = [], array $withSum = [])
|
||||
public function findWithRelationships(string $ordernum = '', array $relationships = [], array $withCount = [], array $withSum = [])
|
||||
{
|
||||
$model = $this->model;
|
||||
if (count($relationships) > 0) {
|
||||
@@ -148,6 +148,6 @@ class InvoiceRepository extends BaseRepository implements InvoiceRepositoryInter
|
||||
}
|
||||
}
|
||||
|
||||
return $model->find($id);
|
||||
return $model->where('order_num', $ordernum)->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ interface InvoiceRepositoryInterface extends BaseRepositoryInterface{
|
||||
public function get_billing_year(int $year = 0);
|
||||
public function get_billing_month(int $month = 0);
|
||||
public function get_billing_day(int|string $day = '');
|
||||
public function findWithRelationships(int $id = 0, array $relationships = [],array $withCount = [], array $withSum = []);
|
||||
public function findWithRelationships(string $ordernum = '', array $relationships = [],array $withCount = [], array $withSum = []);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user