Order the user model's organisations alphabetically by default (this may break any other orderBy's)

This commit is contained in:
2022-02-10 17:17:04 +00:00
parent 97300ab8a5
commit f2c6677dc1

View File

@@ -37,7 +37,7 @@ class User extends UFUser
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
$classMapper = static::$ci->classMapper;
return $this->belongsToMany($classMapper->getClassMapping('organisation'), 'organisation_members', 'user_id', 'organisation_id')->withPivot('flag_admin');;
return $this->belongsToMany($classMapper->getClassMapping('organisation'), 'organisation_members', 'user_id', 'organisation_id')->orderBy('organisations.name', 'asc')->withPivot('flag_admin');
}
/**