I have a list of record.
Its model has this
protected static function booted()
{
static::addGlobalScope(new OrderByDescriptionScope);
}
this scope is doing
public function apply(Builder $builder, Model $model)
{
$builder->orderBy('descrizione', 'asc');
}
but when opening a list, records are never sorted by descrizione
.
This is the suggested method of apply a global scope, as for laravel 8 documentation.
Why does my code not work?
How to set default sorting for laravel backpack?