$npx -y skills add fusengine/agents --skill laravel-attributesUse when migrating Eloquent models, Jobs, Console commands, Controllers, API Resources, Validation, Factories or Seeders to native PHP 8.3 attributes introduced in Laravel 13. Covers all 7 categories of first-party attributes.
| 1 | # Laravel 13 PHP Attributes |
| 2 | |
| 3 | ## Agent Workflow (MANDATORY) |
| 4 | |
| 5 | Before ANY implementation, use `TeamCreate` to spawn 3 agents: |
| 6 | |
| 7 | 1. **fuse-ai-pilot:explore-codebase** - Scan existing models/jobs/controllers for legacy `protected $fillable / $hidden / $connection` properties to convert |
| 8 | 2. **fuse-ai-pilot:research-expert** - Verify Laravel 13 release notes for attribute coverage and edge cases |
| 9 | 3. **mcp__context7__query-docs** - Pull authoritative examples from `laravel.com/docs/13.x` |
| 10 | |
| 11 | After implementation, run **fuse-ai-pilot:sniper** for validation. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | ## Overview |
| 16 | |
| 17 | | Category | Attributes | |
| 18 | |---------|-------------| |
| 19 | | **Eloquent** | `#[Table]` `#[Connection]` `#[Fillable]` `#[Hidden]` `#[Visible]` `#[Guarded]` `#[Unguarded]` `#[Appends]` `#[Touches]` | |
| 20 | | **Queue / Job** | `#[Connection]` `#[Queue]` `#[Tries]` `#[Timeout]` `#[Backoff]` `#[MaxExceptions]` `#[FailOnTimeout]` `#[UniqueFor]` | |
| 21 | | **Console** | `#[Signature]` `#[Description]` | |
| 22 | | **Controllers** | `#[Middleware]` `#[Authorize]` | |
| 23 | | **Validation** | `#[RedirectTo]` `#[StopOnFirstFailure]` | |
| 24 | | **API Resources** | `#[Collects]` `#[PreserveKeys]` | |
| 25 | | **Factories / Seeders** | `#[UseModel]` `#[Seed]` `#[Seeder]` | |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ## Critical Rules |
| 30 | |
| 31 | 1. **NEVER mix attributes and legacy properties** - `#[Fillable(['name'])]` + `protected $fillable = [...]` causes Laravel to ignore the attribute silently |
| 32 | 2. **Class-level only** - All Eloquent / Job / Controller attributes apply to the class, never to private/protected methods |
| 33 | 3. **Single source of truth** - Choose attributes OR properties per class; refactor in one pass to avoid drift |
| 34 | 4. **Inheritance is additive** - Child class attributes merge with parent attributes; redeclare to override |
| 35 | 5. **Import the right namespace** - `Illuminate\Database\Eloquent\Attributes\*` for Eloquent, `Illuminate\Queue\Attributes\*` for Jobs |
| 36 | |
| 37 | --- |
| 38 | |
| 39 | ## Architecture |
| 40 | |
| 41 | ``` |
| 42 | app/ |
| 43 | ├── Models/ |
| 44 | │ └── User.php # #[Table] #[Fillable] #[Hidden] #[Appends] |
| 45 | ├── Jobs/ |
| 46 | │ └── ProcessPodcast.php # #[Connection] #[Queue] #[Tries] #[Backoff] |
| 47 | ├── Console/Commands/ |
| 48 | │ └── SendEmails.php # #[Signature] #[Description] |
| 49 | ├── Http/ |
| 50 | │ ├── Controllers/ |
| 51 | │ │ └── PostController.php # #[Middleware] #[Authorize] |
| 52 | │ └── Resources/ |
| 53 | │ └── PostCollection.php # #[Collects] #[PreserveKeys] |
| 54 | └── Http/Requests/ |
| 55 | └── StoreUserRequest.php # #[RedirectTo] #[StopOnFirstFailure] |
| 56 | ``` |
| 57 | |
| 58 | → See [Model-with-attributes.php.md](references/templates/Model-with-attributes.php.md) for full example |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## Reference Guide |
| 63 | |
| 64 | | Topic | Reference | When to Consult | |
| 65 | |-------|-----------|-----------------| |
| 66 | | **Eloquent models** | [eloquent.md](references/eloquent.md) | Migrating `$fillable / $hidden / $table / $connection` | |
| 67 | | **Queue jobs** | [queue.md](references/queue.md) | Replacing `$tries / $timeout / $backoff` properties | |
| 68 | | **Console commands** | [console.md](references/console.md) | Refactoring `$signature / $description` properties | |
| 69 | | **Controllers** | [controllers.md](references/controllers.md) | Moving middleware/authorize from constructors | |
| 70 | | **Validation** | [validation.md](references/validation.md) | FormRequest redirect + early-stop config | |
| 71 | | **API Resources** | [api-resources.md](references/api-resources.md) | Collection wrapping and key preservation | |
| 72 | | **Factories / Seeders** | [factories-seeders.md](references/factories-seeders.md) | Model binding and seeder discovery | |
| 73 | |
| 74 | ### Templates |
| 75 | |
| 76 | | Template | When to Use | |
| 77 | |----------|-------------| |
| 78 | | [Model-with-attributes.php.md](references/templates/Model-with-attributes.php.md) | Net new Eloquent model | |
| 79 | | [Job-with-attributes.php.md](references/templates/Job-with-attributes.php.md) | Net new queue Job | |
| 80 | |
| 81 | --- |
| 82 | |
| 83 | ## Quick Reference |
| 84 | |
| 85 | ### Eloquent model |
| 86 | |
| 87 | ```php |
| 88 | use Illuminate\Database\Eloquent\Attributes\{Table, Fillable, Hidden, Appends}; |
| 89 | |
| 90 | #[Table('flights')] |
| 91 | #[Fillable(['name', 'origin'])] |
| 92 | #[Hidden(['password'])] |
| 93 | #[Appends(['is_admin'])] |
| 94 | class Flight extends Model {} |
| 95 | ``` |
| 96 | |
| 97 | ### Queue job |
| 98 | |
| 99 | ```php |
| 100 | use Illuminate\Queue\Attributes\{Connection, Queue, Tries, Backoff}; |
| 101 | |
| 102 | #[Connection('redis')] |
| 103 | #[Queue('podcasts')] |
| 104 | #[Tries(5)] |
| 105 | #[Backoff([10, 30, 60])] |
| 106 | class ProcessPodcast implements ShouldQueue {} |
| 107 | ``` |
| 108 | |
| 109 | → See [Job-with-attributes.php.md](references/templates/Job-with-attributes.php.md) for complete example |
| 110 | |
| 111 | --- |
| 112 | |
| 113 | ## Best Pract |