laravel-policies

Define Laravel authorization policies with standard and custom action methods.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/Sivanwol/sabo-platfom --skill laravel-policies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-policies
Source: https://github.com/Sivanwol/sabo-platfom/tree/main/.ai/skills/laravel-policies
Command: npx skills add https://github.com/Sivanwol/sabo-platfom --skill laravel-policies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a structured approach to encapsulate per-resource authorization logic in Laravel, ensuring consistent access control.

Core Features & Use Cases

  • Policy classes implementing standard methods (viewAny, view, create, update, delete) plus custom actions (cancel, approve) to cover common workflow needs.
  • Integration with a central Permission enum to centralize permissions and simplify checks.
  • Ownership and state checks to enforce resource-level access based on user relationships and resource state.
  • Example policy (OrderPolicy) demonstrates typical patterns for route usage and in-controller checks.

Quick Start

Create an OrderPolicy class and bind it to your routes to enforce order permissions.

Frequently Asked Questions about laravel-policies

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

FAQPage Schema
How do I set up Laravel authorization policies for per-resource access control?

Laravel authorization policies encapsulate per-resource access control by defining standard methods like viewAny, view, create, update, and delete within dedicated policy classes. You bind these policies to your routes and controllers to enforce consistent permissions across CRUD workflows.

What is the best way to enforce ownership checks in Laravel CRUD operations?

Enforcing ownership checks in Laravel involves implementing logic within your policy classes to compare resource user relationships against the authenticated user. This ensures users can only modify or view resources they actually own during CRUD workflows.

Can I define custom action permissions beyond standard CRUD methods in Laravel policies?

Yes, Laravel policies support custom action methods beyond standard CRUD operations. You can define specific workflow methods like approve or cancel within your policy classes to handle specialized permission-driven access control for your application's unique state transitions.

How do I centralize permissions for Laravel routing and controller checks?

You can centralize permissions for Laravel routing by integrating your policy classes with a central Permission enum. This approach simplifies authorization checks across routes and controllers, ensuring consistent security rules and preventing scattered permission definitions throughout your application.

Does this Laravel policy approach handle resource state checks for workflow transitions?

Yes, this Laravel policy approach handles resource state checks by evaluating the current state of a resource during authorization. Policies enforce state-based access control to ensure users only perform allowed actions, preventing invalid workflow transitions like modifying completed orders.