feat: Remove the entire frontend customer portal and its associated controllers, while updating customer repositories and adding a cache table migration.
This commit is contained in:
@@ -11,14 +11,18 @@ class CustomerRepository extends BaseRepository implements CustomerRepositoryInt
|
||||
{
|
||||
return Customer::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['name']) && ! empty($data['name'])) {
|
||||
$model = $model->where(function ($query) use ($data) {
|
||||
$name = trim($data['name']);
|
||||
$query->where("firstname", "LIKE", "%$name%");
|
||||
$query->orWhere("lastname", "LIKE", "%$name%");
|
||||
$query->where("fullname", "LIKE", "%$name%");
|
||||
$query->orWhere("company", "LIKE", "%$name%");
|
||||
});
|
||||
}
|
||||
@@ -59,6 +63,9 @@ class CustomerRepository extends BaseRepository implements CustomerRepositoryInt
|
||||
if (count($withCount) > 0) {
|
||||
$model = $model->withCount($withCount);
|
||||
}
|
||||
if ($returnQuery) {
|
||||
return $model;
|
||||
}
|
||||
if (isset($data['page'])) {
|
||||
return $model->paginate(15);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user