Fix orderByProcess() input being null
Fix orderByProcess() input being null by having the input be 2 if the settings values via the session havent been set
This commit is contained in:
parent
1c8ec5fc6b
commit
10e2d7dbba
|
@ -25,7 +25,7 @@ class Misc extends Model
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::addGlobalScope('order', function (Builder $builder) {
|
static::addGlobalScope('order', function (Builder $builder) {
|
||||||
$array = Settings::orderByProcess(Session::get('sort_on'));
|
$array = Settings::orderByProcess(Session::get('sort_on') ?? 2);//created_at desc if not set
|
||||||
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
||||||
$builder->orderBy($array[0], $array[1]);
|
$builder->orderBy($array[0], $array[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Reseller extends Model
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::addGlobalScope('order', function (Builder $builder) {
|
static::addGlobalScope('order', function (Builder $builder) {
|
||||||
$array = Settings::orderByProcess(Session::get('sort_on'));
|
$array = Settings::orderByProcess(Session::get('sort_on') ?? 2);//created_at desc if not set
|
||||||
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
||||||
$builder->orderBy($array[0], $array[1]);
|
$builder->orderBy($array[0], $array[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class SeedBoxes extends Model
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::addGlobalScope('order', function (Builder $builder) {
|
static::addGlobalScope('order', function (Builder $builder) {
|
||||||
$array = Settings::orderByProcess(Session::get('sort_on'));
|
$array = Settings::orderByProcess(Session::get('sort_on') ?? 2);//created_at desc if not set
|
||||||
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
||||||
$builder->orderBy($array[0], $array[1]);
|
$builder->orderBy($array[0], $array[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Server extends Model
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::addGlobalScope('order', function (Builder $builder) {
|
static::addGlobalScope('order', function (Builder $builder) {
|
||||||
$array = Settings::orderByProcess(Session::get('sort_on'));
|
$array = Settings::orderByProcess(Session::get('sort_on') ?? 2);//created_at desc if not set
|
||||||
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
||||||
$builder->orderBy($array[0], $array[1]);
|
$builder->orderBy($array[0], $array[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Shared extends Model
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::addGlobalScope('order', function (Builder $builder) {
|
static::addGlobalScope('order', function (Builder $builder) {
|
||||||
$array = Settings::orderByProcess(Session::get('sort_on'));
|
$array = Settings::orderByProcess(Session::get('sort_on') ?? 2);//created_at desc if not set
|
||||||
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
if (!in_array(Session::get('sort_on'), [3, 4, 5, 6], true)) {
|
||||||
$builder->orderBy($array[0], $array[1]);
|
$builder->orderBy($array[0], $array[1]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user