mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Merge pull request #8227 from paulwer/v5-develop
adding additional filter methods
This commit is contained in:
commit
2dcdd4d72c
@ -26,12 +26,13 @@ class BankIntegrationFilters extends QueryFilters
|
|||||||
*/
|
*/
|
||||||
public function name(string $name = ''): Builder
|
public function name(string $name = ''): Builder
|
||||||
{
|
{
|
||||||
if(strlen($name) >=1)
|
if (strlen($name) == 0) {
|
||||||
return $this->builder->where('bank_account_name', 'like', '%'.$name.'%');
|
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('bank_account_name', 'like', '%'.$name.'%');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter based on search text.
|
* Filter based on search text.
|
||||||
*
|
*
|
||||||
@ -90,10 +91,14 @@ class BankIntegrationFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,13 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
*/
|
*/
|
||||||
public function name(string $name = ''): Builder
|
public function name(string $name = ''): Builder
|
||||||
{
|
{
|
||||||
if(strlen($name) >=1)
|
if (strlen($name) == 0) {
|
||||||
return $this->builder->where('bank_account_name', 'like', '%'.$name.'%');
|
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('bank_account_name', 'like', '%'.$name.'%');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter based on search text.
|
* Filter based on search text.
|
||||||
*
|
*
|
||||||
@ -40,7 +41,7 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -66,7 +67,7 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function client_status(string $value = '') :Builder
|
public function client_status(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($value) == 0) {
|
if (strlen($value) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -123,12 +124,13 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
if(!is_array($sort_col))
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
if($sort_col[0] == 'deposit')
|
if($sort_col[0] == 'deposit')
|
||||||
return $this->builder->where('base_type', 'CREDIT')->orderBy('amount', $sort_col[1]);
|
return $this->builder->where('base_type', 'CREDIT')->orderBy('amount', $sort_col[1]);
|
||||||
|
@ -30,12 +30,13 @@ class BankTransactionRuleFilters extends QueryFilters
|
|||||||
*/
|
*/
|
||||||
public function name(string $name = ''): Builder
|
public function name(string $name = ''): Builder
|
||||||
{
|
{
|
||||||
if(strlen($name) >=1)
|
if (strlen($name) == 0) {
|
||||||
return $this->builder->where('name', 'like', '%'.$name.'%');
|
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('name', 'like', '%'.$name.'%');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter based on search text.
|
* Filter based on search text.
|
||||||
*
|
*
|
||||||
@ -43,7 +44,7 @@ class BankTransactionRuleFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -61,10 +62,14 @@ class BankTransactionRuleFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +81,7 @@ class BankTransactionRuleFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function baseQuery(int $company_id, User $user) : Builder
|
public function baseQuery(int $company_id, User $user): Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,25 @@ class ClientFilters extends QueryFilters
|
|||||||
*/
|
*/
|
||||||
public function name(string $name = ''): Builder
|
public function name(string $name = ''): Builder
|
||||||
{
|
{
|
||||||
if(strlen($name) >=1)
|
if (strlen($name) == 0) {
|
||||||
return $this->builder->where('name', 'like', '%'.$name.'%');
|
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('name', 'like', '%'.$name.'%');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter by balance.
|
* Filter by balance.
|
||||||
*
|
*
|
||||||
* @param string $balance
|
* @param string $balance
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function balance(string $balance): Builder
|
public function balance(string $balance = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($balance) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
$parts = $this->split($balance);
|
$parts = $this->split($balance);
|
||||||
|
|
||||||
return $this->builder->where('balance', $parts->operator, $parts->value);
|
return $this->builder->where('balance', $parts->operator, $parts->value);
|
||||||
@ -55,27 +60,29 @@ class ClientFilters extends QueryFilters
|
|||||||
* @param string balance
|
* @param string balance
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function between_balance(string $balance): Builder
|
public function between_balance(string $balance = ''): Builder
|
||||||
{
|
{
|
||||||
$parts = explode(':', $balance);
|
$parts = explode(':', $balance);
|
||||||
|
|
||||||
if (! is_array($parts)) {
|
if (!is_array($parts) || count($parts) != 2) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->builder->whereBetween('balance', [$parts[0], $parts[1]]);
|
return $this->builder->whereBetween('balance', [$parts[0], $parts[1]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function email(string $email = ''):Builder
|
public function email(string $email = ''): Builder
|
||||||
{
|
{
|
||||||
return
|
if (strlen($email) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
$this->builder->whereHas('contacts', function ($query) use ($email) {
|
return $this->builder->whereHas('contacts', function ($query) use ($email) {
|
||||||
$query->where('email', $email);
|
$query->where('email', $email);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function client_id(string $client_id = '') :Builder
|
public function client_id(string $client_id = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($client_id) == 0) {
|
if (strlen($client_id) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -84,13 +91,21 @@ class ClientFilters extends QueryFilters
|
|||||||
return $this->builder->where('id', $this->decodePrimaryKey($client_id));
|
return $this->builder->where('id', $this->decodePrimaryKey($client_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function id_number(string $id_number = ''):Builder
|
public function id_number(string $id_number = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($id_number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->where('id_number', $id_number);
|
return $this->builder->where('id_number', $id_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function number(string $number = ''):Builder
|
public function number(string $number = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->where('number', $number);
|
return $this->builder->where('number', $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +116,7 @@ class ClientFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -128,10 +143,14 @@ class ClientFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
if($sort_col[0] == 'display_name')
|
if($sort_col[0] == 'display_name')
|
||||||
$sort_col[0] = 'name';
|
$sort_col[0] = 'name';
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class CompanyGatewayFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -43,10 +43,14 @@ class CompanyGatewayFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class CreditFilters extends QueryFilters
|
|||||||
* @param string credit_status The credit status as seen by the client
|
* @param string credit_status The credit status as seen by the client
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function credit_status(string $value = '') :Builder
|
public function credit_status(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($value) == 0) {
|
if (strlen($value) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -66,7 +66,7 @@ class CreditFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -85,16 +85,29 @@ class CreditFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +136,7 @@ class CreditFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
private function contactViewFilter() : Builder
|
private function contactViewFilter(): Builder
|
||||||
{
|
{
|
||||||
return $this->builder
|
return $this->builder
|
||||||
->whereCompanyId(auth()->guard('contact')->user()->company->id)
|
->whereCompanyId(auth()->guard('contact')->user()->company->id)
|
||||||
|
@ -44,16 +44,17 @@ class DesignFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
if(is_array($sort_col))
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the query by the users company ID.
|
* Filters the query by the users company ID.
|
||||||
*
|
*
|
||||||
|
@ -54,16 +54,17 @@ class DocumentFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort = '') : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
if(is_array($sort_col))
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function company_documents($value = 'false')
|
public function company_documents($value = 'false')
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ class ExpenseCategoryFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -41,10 +41,14 @@ class ExpenseCategoryFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($sort_col) && in_array($sort_col[1], ['asc', 'desc']) && in_array($sort_col[0], ['name']))
|
if (is_array($sort_col) && in_array($sort_col[1], ['asc', 'desc']) && in_array($sort_col[0], ['name']))
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ExpenseFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -53,7 +53,7 @@ class ExpenseFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function client_status(string $value = '') :Builder
|
public function client_status(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($value) == 0) {
|
if (strlen($value) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -132,16 +132,29 @@ class ExpenseFilters extends QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($sort_col) && in_array($sort_col[1], ['asc', 'desc']) && in_array($sort_col[0], ['public_notes', 'date', 'id_number', 'custom_value1', 'custom_value2', 'custom_value3', 'custom_value4'])) {
|
if (is_array($sort_col) && in_array($sort_col[1], ['asc', 'desc']) && in_array($sort_col[0], ['public_notes', 'date', 'id_number', 'custom_value1', 'custom_value2', 'custom_value3', 'custom_value4'])) {
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
@ -179,8 +179,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
//catch invalid explode array count
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
if (count($sort_col) == 1) {
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +223,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
private function contactViewFilter() : Builder
|
private function contactViewFilter(): Builder
|
||||||
{
|
{
|
||||||
return $this->builder
|
return $this->builder
|
||||||
->whereCompanyId(auth()->guard('contact')->user()->company->id)
|
->whereCompanyId(auth()->guard('contact')->user()->company->id)
|
||||||
|
@ -62,25 +62,30 @@ class PaymentFilters extends QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
if(is_array($sort_col))
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function number(string $number = ''): Builder
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
{
|
|
||||||
return $this->builder->where('number', $number);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,10 +42,14 @@ class PaymentTermFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +58,13 @@ class ProductFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
if(!is_array($sort_col))
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class ProjectFilters extends QueryFilters
|
|||||||
* @return Illuminate\Eloquent\Query\Builder
|
* @return Illuminate\Eloquent\Query\Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') :Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -38,16 +38,29 @@ class ProjectFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Illuminate\Eloquent\Query\Builder
|
* @return Illuminate\Eloquent\Query\Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) :Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
if(is_array($sort_col))
|
if(is_array($sort_col))
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
@ -57,7 +70,7 @@ class ProjectFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Illuminate\Eloquent\Query\Builder
|
* @return Illuminate\Eloquent\Query\Builder
|
||||||
*/
|
*/
|
||||||
public function entityFilter() :Builder
|
public function entityFilter(): Builder
|
||||||
{
|
{
|
||||||
return $this->builder->company();
|
return $this->builder->company();
|
||||||
}
|
}
|
||||||
|
@ -100,16 +100,29 @@ class PurchaseOrderFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +149,7 @@ class PurchaseOrderFilters extends QueryFilters
|
|||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
private function contactViewFilter() : Builder
|
private function contactViewFilter(): Builder
|
||||||
{
|
{
|
||||||
return $this->builder
|
return $this->builder
|
||||||
->whereCompanyId(auth()->guard('contact')->user()->company->id)
|
->whereCompanyId(auth()->guard('contact')->user()->company->id)
|
||||||
|
@ -136,7 +136,7 @@ abstract class QueryFilters
|
|||||||
* @param string filter
|
* @param string filter
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function status(string $filter = '') : Builder
|
public function status(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -241,7 +241,7 @@ abstract class QueryFilters
|
|||||||
return $this->builder->where('is_deleted', $value);
|
return $this->builder->where('is_deleted', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function client_id(string $client_id = '') :Builder
|
public function client_id(string $client_id = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($client_id) == 0) {
|
if (strlen($client_id) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -250,7 +250,7 @@ abstract class QueryFilters
|
|||||||
return $this->builder->where('client_id', $this->decodePrimaryKey($client_id));
|
return $this->builder->where('client_id', $this->decodePrimaryKey($client_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function vendor_id(string $vendor_id = '') :Builder
|
public function vendor_id(string $vendor_id = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($vendor_id) == 0) {
|
if (strlen($vendor_id) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
@ -113,7 +113,11 @@ class QuoteFilters extends QueryFilters
|
|||||||
|
|
||||||
public function number($number = ''): Builder
|
public function number($number = ''): Builder
|
||||||
{
|
{
|
||||||
return $this->builder->where('number', 'like', '%'.$number.'%');
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,10 +126,14 @@ class QuoteFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
if($sort_col[0] == 'valid_until')
|
if($sort_col[0] == 'valid_until')
|
||||||
$sort_col[0] = 'due_date';
|
$sort_col[0] = 'due_date';
|
||||||
|
|
||||||
|
@ -40,16 +40,29 @@ class RecurringExpenseFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,16 +83,29 @@ class RecurringInvoiceFilters extends QueryFilters
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,16 +39,29 @@ class RecurringQuoteFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Illuminate\Database\Eloquent\Builder
|
* @return Illuminate\Database\Eloquent\Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,14 @@ class SubscriptionFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,18 +18,30 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
*/
|
*/
|
||||||
class SystemLogFilters extends QueryFilters
|
class SystemLogFilters extends QueryFilters
|
||||||
{
|
{
|
||||||
public function type_id(int $type_id) :Builder
|
public function type_id(string $type_id = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($type_id) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->where('type_id', $type_id);
|
return $this->builder->where('type_id', $type_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function category_id(int $category_id) :Builder
|
public function category_id(string $category_id = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($category_id) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->where('category_id', $category_id);
|
return $this->builder->where('category_id', $category_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function event_id(int $event_id) :Builder
|
public function event_id(string $event_id = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($event_id) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->where('event_id', $event_id);
|
return $this->builder->where('event_id', $event_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +52,7 @@ class SystemLogFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -55,10 +67,14 @@ class SystemLogFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,16 +82,29 @@ class TaskFilters extends QueryFilters
|
|||||||
return $this->builder->where('project_id', $this->decodePrimaryKey($project));
|
return $this->builder->where('project_id', $this->decodePrimaryKey($project));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,14 @@ class TaskStatusFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class TaxRateFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = '') : Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
@ -42,10 +42,14 @@ class TaxRateFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,14 @@ class TokenFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +46,14 @@ class UserFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +80,9 @@ class UserFilters extends QueryFilters
|
|||||||
public function with(string $value = ''): Builder
|
public function with(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
if(strlen($value) == 0)
|
if(strlen($value) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder
|
return $this->builder
|
||||||
->orWhere($this->with_property, $value)
|
->orWhere($this->with_property, $value)
|
||||||
|
@ -46,16 +46,29 @@ class VendorFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function number(string $number = ''): Builder
|
||||||
|
{
|
||||||
|
if (strlen($number) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where('number', $number);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,14 @@ class WebhookFilters extends QueryFilters
|
|||||||
* @param string sort formatted as column|asc
|
* @param string sort formatted as column|asc
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user