Laravel Policies

🌐Community
by leeovery · vlatest · Repository

Laravel Policies define access rules for your application, ensuring users only see and interact with resources they're authorized to view or modify.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add laravel-policies npx -- -y @trustedskills/laravel-policies
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "laravel-policies": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/laravel-policies"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill provides access to Laravel Policies, allowing you to define and enforce authorization logic within a Laravel application. It enables fine-grained control over user actions by specifying rules that determine whether an authenticated user can perform certain operations on resources. This promotes secure and maintainable code by centralizing authorization concerns.

When to use it

  • Implementing Role-Based Access Control (RBAC): Define policies for different user roles (e.g., admin, editor, viewer) to restrict access to specific features or data.
  • Protecting API endpoints: Secure your API routes by using policies to verify that only authorized users can access certain resources and perform actions.
  • Enforcing resource ownership: Ensure users can only modify or delete resources they own, preventing unauthorized modifications.
  • Centralizing authorization logic: Move complex authorization checks out of controllers and into reusable policy classes for improved code organization.

Key capabilities

  • Define policies as PHP classes.
  • Implement authorize() methods to define access rules.
  • Apply policies to Eloquent models or controllers.
  • Centralized authorization logic.

Example prompts

  • "Create a Laravel Policy for the 'Post' model that allows admins to delete posts."
  • "Generate a policy class named 'CommentPolicy'."
  • "Show me an example of how to apply this policy to a controller action."

Tips & gotchas

  • Requires a working Laravel application.
  • Familiarity with Eloquent models and controllers is beneficial for effective use.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
leeovery
Installs
22

🌐 Community

Passed automated security scans.