0064-laravel-policies

Implement Laravel policy methods with Permission enum and ownership checks.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/MrJmpl3/codex_____data_____configuration --skill 0064-laravel-policies
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: 0064-laravel-policies
Source: https://github.com/MrJmpl3/codex_____data_____configuration/tree/main/skills/0064-laravel-policies
Command: npx skills add https://github.com/MrJmpl3/codex_____data_____configuration --skill 0064-laravel-policies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you implement consistent authorization rules in Laravel so users can only access resources they are allowed to view, modify, or act on.

Core Features & Use Cases

  • Policy-based authorization: Define Laravel policy methods for common actions like listing, viewing, creating, updating, and deleting resources.
  • Permission enum delegation: Centralize permission strings by using a Permission enum and calling $user->can(...) for authorization checks.
  • Ownership and state checks: Add resource ownership constraints (e.g., customer_id) and enforce business-state rules (e.g., pending orders can be deleted).
  • Custom actions: Implement non-standard operations (e.g., cancel) by composing existing policy logic.

Quick Start

Create or update an OrderPolicy in App\Policies and use permission enums plus ownership/state checks to authorize each action.

Frequently Asked Questions about 0064-laravel-policies

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

FAQPage Schema
How do I implement Laravel authorization policies for resource actions?▼

Laravel policies secure resource actions by defining methods for listing, viewing, creating, updating, and deleting. You write policy methods that delegate to a Permission enum, returning booleans based on user capability and resource attributes.

What is the best way to enforce user permissions and resource ownership in Laravel?▼

Enforce user permissions by combining ability checks with resource ownership constraints. You can add attributes like customer_id to verify ownership and use a Permission enum to centralize authorization strings for clear access control.

How do I authorize custom operations like cancel in a Laravel policy?▼

Authorize custom operations by composing existing policy logic. You implement non-standard actions within your policy class by combining the defined permission enums and resource state constraints to return a boolean authorization result.

Can I use a Permission enum for Laravel ability checks across different resources?▼

Yes, you can centralize permission strings using a Permission enum. By calling the user can method with the enum, your Laravel policies can consistently delegate authorization checks across multiple resource actions and custom operations.

How do I enforce business-state rules when deleting resources in Laravel?▼

Enforce business-state rules by adding state constraints to your Laravel policy methods. You write logic that checks the model state, ensuring only resources matching specific conditions, such as pending orders, can be deleted.

When do I need to define a YAML-frontmatter entry point for Laravel policies?▼

You need a YAML-frontmatter entry point in SKILL.md to implement Laravel authorization policies. This setup defines the policy structure, ensuring resource actions like viewing and updating are protected by ownership and state constraints.