Global Scope Doesn't Work In Table Builder

I have this global scope code inside my TopicSetting model
protected static function booted(): void
{
static::addGlobalScope('sortOrder', function (Builder $builder) {
$builder->orderBy('sort_order');
});
}
protected static function booted(): void
{
static::addGlobalScope('sortOrder', function (Builder $builder) {
$builder->orderBy('sort_order');
});
}
but when i open the table page which is the list page, the global scope doesn't work but when i do simpel query like
TopicSetting::all() //it works ordered asc by sort_order
TopicSetting::all() //it works ordered asc by sort_order
but in the table as default it doesn't work, did i miss something? let me know, thank youu..
No description
4 Replies
christmex
christmex10mo ago
there is many way to achieve that, but im wondering why the global scope doesnt work as default
No description
christmex
christmex10mo ago
when i use this way, it works fine, but still i need to understand why the global scope not works as default
daikazu
daikazu2mo ago
Any luck with this? I just ran across a similar problem.
Dan Harrin
Dan Harrin2mo ago
i think this has been fixed as a bug since the thread was created but i encourage you to open an issue with a reproduction repo if you still have issues