Roles

A role represents a group of tasks that a user that is assigned the role is allowed to perform. For example, the system administrator can be regarded as the owner of the system and as such, is permitted to perform all the tasks in the system. He/she can create users, delete and edit products, etc.


# Default Roles

These roles are created through seeds while setup a project.


# Create a Role

Roles can be created in following ways:-

Manually:

User can create a role directly from the Role Section in User & Access.

Seeds:

User can create a role through seeds. Create a json file of name roles.json at .../VaahCms/Modules/{module_name}>/Database/Seeds/json/ this directory.

roles.json
copy

To run this seed, you have to add some code in DatabaseTableSeeder.php at .../VaahCms/Modules/{module_name}>/Database/Seeds/ this directory.

DatabaseTableSeeder.php
copy

# Manage Users

You can assign roles to a user in Roles section. By clicking on User column, a page will open that contain list of Users along with Yes/NO Button.


# Manage Permission

You can add permissions in a role in Roles section. By clicking on Permission column, a page will open that contain list of Permissions along with Yes/NO Button.


VaahCms provide a method to check the User's permission.

\Auth::user()->hasRole('administrator')