feat: Implement order management with datatable display and updated forms
This commit is contained in:
@@ -16,8 +16,12 @@ class OrderCachedRepository extends BaseCachedRepository implements OrderReposit
|
||||
{
|
||||
return $this->orderRepository->getModel();
|
||||
}
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'], bool $returnQuery = false)
|
||||
{
|
||||
if ($returnQuery) {
|
||||
return $this->orderRepository->filter($data, $relationships, $withCount, $select, true);
|
||||
}
|
||||
|
||||
$cacheKey = $this->getCacheKey(md5(json_encode([
|
||||
'filterItem' => [
|
||||
'data' => $data,
|
||||
|
||||
@@ -12,7 +12,7 @@ class OrderRepository extends BaseRepository implements OrderRepositoryInterface
|
||||
{
|
||||
return Order::class;
|
||||
}
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'], bool $returnQuery = false)
|
||||
{
|
||||
$model = $this->model->with($relationships)->select($select);
|
||||
if (isset($data['client']) && ! empty($data['client'])) {
|
||||
@@ -66,6 +66,11 @@ class OrderRepository extends BaseRepository implements OrderRepositoryInterface
|
||||
if (count($withCount) > 0) {
|
||||
$model = $model->withCount($withCount);
|
||||
}
|
||||
|
||||
if ($returnQuery) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
if (isset($data['limit']) && $data['limit']) {
|
||||
return $model->latest('id')->take($data['limit'])->get();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Repositories\Order;
|
||||
use App\Repositories\BaseRepositoryInterface;
|
||||
|
||||
interface OrderRepositoryInterface extends BaseRepositoryInterface{
|
||||
public function filter(array $data = [],array $relationships = [],array $withCount = [],array $select = ['*']);
|
||||
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 =[]);
|
||||
}
|
||||
Reference in New Issue
Block a user