Roles & Permissions

Roles & Permissions

Thanks to Craftable PRO you have been given all you need for setting roles and permissions. We enhanced the popular Spatie Permissions (opens in a new tab) package adding effective out-of-the-box UI.


By default, Craftable PRO comes with two main roles: Administrator and Guest. You are able to create as many roles as you need after clicking on "Add role". You are also able to edit and delete the role after clicking on the icons in the listing. To delete a role, first make sure that no user has it assigned.


Default role after registration

If you have enabled self-registration (see Users) you can define the default role for newly registered users in Craftable PRO config:

 'self_registration' => [
        // define if users can self register into craftable pro interface
        'enabled' => true,
        // and if enabled, then which role(s) they should have assigned by default. Use role names here.
        // It can be a string for one role or an array for multiple roles.
        'default_role' => 'Guest',


After roles are defined you can assign them the permissions by clicking on "Manage permissions" next to the roles in Craftable PRO admin.


In your code permissions can be used for example in authorize method in Request like this:

return Gate::allows('craftable-pro.posts.index');

or in directly in Controllers:


Translatable permissions

For a better UI experience you may want to have manageable permissions translations. Craftable PRO has your back, just call

php artisan craftable-pro:generate-permission-translations

If you are using pipelines for deployment, the recommended way is to run this command automatically within them. It can be called at any point after running the migrations.

Now you have all your permission strings available in the Translations manager (see Translations).

Last updated on December 5, 2023