Example of Global scopes in Kovah/LinkAce

File app/Scopes/OrderNameScope.php (link to Github)
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;

class OrderNameScope implements Scope
{
    public function apply(Builder $builder, Model $model): void
    {
        $builder->orderBy('name', 'ASC');
    }
}
File app/Models/LinkList.php (link to Github)
use App\Scopes\OrderNameScope;

class LinkList extends Model
{
    protected static function boot(): void
    {
        parent::boot();

        static::addGlobalScope(new OrderNameScope());
    }
}

Additional resources on global scopes: