Files
core/app/Enumerations/UserRoles.php
T
Michal Kváček 8fcc5d041c FEATURE: move user roles into separate enumeration.
This commit moves list of user roles into separate class (with own namespace), so we can access this data anywhere from application.
2016-01-24 20:43:41 +01:00

35 lines
859 B
PHP

<?php
namespace App\Enumerations;
use App\Models\User;
class UserRoles
{
/**
* Getter for roles
*
* This method returns only list of roles as inserted into database
*
* @return array
*/
public static function getSimple()
{
return array_values(self::getWithTranslations());
}
/**
* Getter for roles with translations
*
* This method returns all user roles as keys. Values are strings used for translations.
*
* @return array
*/
public static function getWithTranslations()
{
return [
User::ROLE_ADMIN => 'admin/userManagement.role_' . User::ROLE_ADMIN,
User::ROLE_EDITOR => 'admin/userManagement.role_' . User::ROLE_EDITOR,
User::ROLE_VISITOR => 'admin/userManagement.role_' . User::ROLE_VISITOR
];
}
}