mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 12:24:35 -04:00
Fixes for ?with query when using hashed_id
This commit is contained in:
parent
9dee71bc92
commit
d884537e20
@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
*/
|
*/
|
||||||
class ClientFilters extends QueryFilters
|
class ClientFilters extends QueryFilters
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter by name.
|
* Filter by name.
|
||||||
*
|
*
|
||||||
|
@ -293,8 +293,16 @@ abstract class QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function with(string $value): Builder
|
public function with(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
|
if (strlen($value) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->with_property == 'id') {
|
||||||
|
$value = $this->decodePrimaryKey($value);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder
|
return $this->builder
|
||||||
->orWhere($this->with_property, $value)
|
->orWhere($this->with_property, $value)
|
||||||
->orderByRaw("{$this->with_property} = ? DESC", [$value])
|
->orderByRaw("{$this->with_property} = ? DESC", [$value])
|
||||||
|
@ -40,15 +40,15 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
// DB::listen(function($query) {
|
\DB::listen(function($query) {
|
||||||
// nlog(
|
nlog(
|
||||||
// $query->sql,
|
$query->sql,
|
||||||
// [
|
[
|
||||||
// 'bindings' => $query->bindings,
|
'bindings' => $query->bindings,
|
||||||
// 'time' => $query->time
|
'time' => $query->time
|
||||||
// ]
|
]
|
||||||
// );
|
);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// Model::preventLazyLoading(
|
// Model::preventLazyLoading(
|
||||||
// !$this->app->isProduction()
|
// !$this->app->isProduction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user