mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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
|
||||
{
|
||||
|
||||
/**
|
||||
* Filter by name.
|
||||
*
|
||||
|
@ -293,8 +293,16 @@ abstract class QueryFilters
|
||||
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
|
||||
->orWhere($this->with_property, $value)
|
||||
->orderByRaw("{$this->with_property} = ? DESC", [$value])
|
||||
|
@ -40,15 +40,15 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// DB::listen(function($query) {
|
||||
// nlog(
|
||||
// $query->sql,
|
||||
// [
|
||||
// 'bindings' => $query->bindings,
|
||||
// 'time' => $query->time
|
||||
// ]
|
||||
// );
|
||||
// });
|
||||
\DB::listen(function($query) {
|
||||
nlog(
|
||||
$query->sql,
|
||||
[
|
||||
'bindings' => $query->bindings,
|
||||
'time' => $query->time
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// Model::preventLazyLoading(
|
||||
// !$this->app->isProduction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user