permission-system

Automate role-based access control in Laravel with Spatie Laravel Permission.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/Saidabbos/homemessage-admin --skill permission-system
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: permission-system
Source: https://github.com/Saidabbos/homemessage-admin/tree/main/.ai/skills/permission-system
Command: npx skills add https://github.com/Saidabbos/homemessage-admin --skill permission-system

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers implement and manage role-based access control and authorization in Laravel applications using the Spatie Laravel Permission package.

Core Features & Use Cases

  • Define roles and permissions with Spatie Laravel Permission to control what users can do.
  • Protect routes, controllers, policies, and gates with middleware and policies.
  • Enforce access in Blade templates and during data access checks, ensuring secure UI and backend behavior.

Quick Start

Install the spatie/laravel-permission package, publish the configuration, run migrations, and create roles/permissions. Assign roles to users and protect routes using middleware, gates, and policies. Use seeding or tinker to assign initial roles and permissions.

Frequently Asked Questions about permission-system

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up role-based access control in Laravel using Spatie permission?

To set up role-based access control in Laravel, install the spatie/laravel-permission package, publish the configuration, run migrations, and define roles and permissions. Assign them to users and protect routes using middleware, gates, and policies.

What is the best way to secure Laravel routes and controllers with RBAC?

The best way to secure Laravel routes and controllers with RBAC is by applying Laravel's built-in middleware and policies. This ensures consistent, auditable authorization by checking user roles and permissions before access is granted.

Can I enforce role permissions in Laravel Blade templates and during data access?

Yes, you can enforce role permissions in Laravel Blade templates and during data access checks. This ensures secure UI behavior by hiding elements restricted by permissions and validating backend data access consistently.

Does the Spatie Laravel Permission package support permission caching?

Yes, the Spatie Laravel Permission package supports permission caching. It uses Laravel's middleware, gates, and policies alongside caching mechanisms to manage roles and permissions efficiently and ensure consistent authorization.

How do I assign initial roles and permissions after running Laravel migrations?

After running Laravel migrations, assign initial roles and permissions using database seeding or Tinker. Create the necessary roles and permissions, attach them to users, and then secure routes using the configured middleware and policies.