spatiespatieOfficialยท1 Agent Skills Included

laravel-permission

Manage user roles and permissions in Laravel applications

Adds role-based access control and permission management to Laravel applications. Assigns roles and permissions to users, protects routes with middleware, and checks access in Blade templates and policies. Eliminates hand-written authorization logic, supports teams and super admins, and caches permissions for fast checks.
npx skills add spatie/laravel-permission --all -g -y

All Skills in This Repository (1)

Pure Emerald Level Indicators

Frequently Asked Questions

FAQPage Schema
How to install laravel-permission?โ–ผ

Run `npx skills add spatie/laravel-permission --all -g -y` in your terminal to install all tools in this suite globally.

How to add roles and permissions in Laravel?โ–ผ

Add the HasRoles trait to your User model, then create roles and permissions and assign them with simple methods like assignRole and givePermissionTo.

How to protect Laravel routes by role?โ–ผ

Register the package middleware aliases and apply them to routes, for example role:admin or permission:edit articles, to block unauthorized users automatically.

Does laravel-permission support teams and multi-tenancy?โ–ผ

Yes. Enable the teams option in the config file before migrating, then set the active team ID so roles and permissions are scoped per team.

Can I check permissions in Blade templates?โ–ผ

Yes. Use the standard @can directive or the package's @role and @hasanyrole directives to show or hide content based on user access.

Related Repositories in Software Engineering

View All in Software Engineeringโ†’