Role Management

The Pro theme allows you to add user roles. By default, the theme comes with Admin, Creator and Member roles. To access the role management example click the "Examples/Role Management" link in the left sidebar or add /role to the URL. Here you can add/edit new roles. Deletion is not allowed in this section. To add a new role click the "Add role" button and to edit an existing role click the dotted menu (available on every table line) and then click "Edit". In both cases, you will be directed to a form which allows you to modify the name and description of a role.

The policy which authorizes the user to access the role management option is implemented in App\Policies\RolePolicy.php.

You can find this functionality in App\Http\RoleController.php.

Also, validation rules were added so you will know exactly what to input in the form fields (see App\Http\Requests\RoleRequest). Note that these validation rules also apply for the role edit option.

          
              public function rules()
              {
                  return [
                      'name' => [
                          'required', 'min:3', Rule::unique((new Role)->getTable())->ignore($this->route()->role->id ?? null)
                      ],
                      'description' => [
                          'nullable', 'min:5'
                      ]
                  ];
              }