Skip to content

[13.x] Check traits in resolveClassAttribute #60566

Draft
jackbayliss wants to merge 4 commits into
laravel:13.xfrom
jackbayliss:13.x-trait-model-attributes
Draft

[13.x] Check traits in resolveClassAttribute #60566
jackbayliss wants to merge 4 commits into
laravel:13.xfrom
jackbayliss:13.x-trait-model-attributes

Conversation

@jackbayliss

@jackbayliss jackbayliss commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This is the exact same as I did here #60519

This means queue attributes 🤝 model attributes (We are same same but different)

This essentially means, traits can carry model attributes which means we can put attributes on a trait, and reuse the trait.

This only checks traits on the current class in the hierarchy same as the other PR

Nice for package maintainers, or teams using traits.

#[Connection('warehouse')]
trait UsesWarehouse
{
  // scopes etc... that may be shared
}

class Product extends Model
{
    use UsesWarehouse;
}

class StockTransfer extends Model
{
    use UsesWarehouse;
}

I'm completely fine if you close this, just thought I'd try bring the same behaviour as queues to models for the attributes 🫡

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant