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.
This commit is contained in:
Michal Kváček
2016-01-24 20:43:41 +01:00
parent 7a08a11497
commit 8fcc5d041c
3 changed files with 48 additions and 8 deletions
+2 -5
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Enumerations\UserRoles;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Http\Requests\CreateNewUserRequest;
@@ -19,11 +20,7 @@ class CreateNewUser extends Controller
public function getNewUser()
{
// define list of roles, this list will be used in template for selecting proper role for user
$roles = [
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
];
$roles = UserRoles::getWithTranslations();
// render view
return $this->view('admin.userManagement.new', ['roles' => $roles]);