Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

For a software dev like me who has no idea how to create a cute hand-drawn dashed line, this course just 100% works.

— Ira Zayats, Developer

User Role Repository

To work with the with Role Repository, use the following Facade:

use Statamic\Facades\Role;

Methods

Methods Description
all() Get all User Roles
find($id) Get User Roles by id
make() Makes a new Role instance
Hot Tip!

The id is the same as handle while using the default Stache driver.

Creating

Start by making an instance of a user role with the make method. You can pass the handle into it.

$role = Role::make('editors');

You may call additional methods on the role to customize it further.

$role
->title('Editors')
->permissions($permissions); // array of permissions

Finally, save it.

$role->save();
HR: Section
Learn More!

There is more to learn more in these related articles:

Fieldtypes

HR: Section
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →
Hello there! Are you looking for the Statamic v2 documentation?