lc:generate-spatie-permissions

Inject HasRoles traits into Eloquent models and generate idempotent seeders.

12|2|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/edulazaro/laraclaude --skill lc-generate-spatie-permissions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lc:generate-spatie-permissions
Source: https://github.com/edulazaro/laraclaude/tree/main/skills/generate-spatie-permissions
Command: npx skills add https://github.com/edulazaro/laraclaude --skill lc-generate-spatie-permissions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates the manual, error-prone process of setting up role-based access control in Laravel by automating the configuration of the spatie/laravel-permission package.

Core Features & Use Cases

  • Automated Trait Injection: Automatically adds the HasRoles trait to your Eloquent models.
  • Seeder Generation: Creates idempotent, production-ready seeders for roles and permissions.
  • Use Case: Quickly bootstrap a new administrative dashboard by generating a standard set of roles and permissions and wiring them into your existing User model without manual file editing.

Quick Start

Use the lc:generate-spatie-permissions skill to add role management to the User model and create a base seeder.

Frequently Asked Questions about lc:generate-spatie-permissions

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

FAQPage Schema
How do I scaffold Spatie Laravel permissions automatically?

Scaffolding Spatie Laravel permissions is automated by injecting the HasRoles trait into Eloquent models and generating idempotent database seeders for roles and permissions. This eliminates manual file editing and configuration errors in Laravel applications.

How do I add role-based access control to my Laravel Eloquent models?

Adding role-based access control to Laravel Eloquent models requires injecting the HasRoles trait. The scaffolding process validates trait namespaces and inspects configuration files to ensure proper integration with the spatie/laravel-permission package.

Can I generate idempotent seeders for Laravel roles and permissions?

Generating idempotent seeders for Laravel roles and permissions is a core feature. The scaffolding process creates production-ready seeders that can be run repeatedly without duplicating data, and automatically registers them within the Laravel framework.

Does this Laravel permissions scaffolding work with existing User models?

Yes, the Laravel permissions scaffolding works with existing User models. It inspects your current Eloquent model structure and config file, then injects the necessary traits without requiring manual file editing or breaking existing application logic.

What is the best way to set up Spatie laravel-permission in a new Laravel app?

The best way to set up Spatie laravel-permission is using automated scaffolding to inject traits into Eloquent models and generate idempotent database seeders. This approach avoids the manual, error-prone configuration process and quickly bootstraps role-based access control.