Skip to content

Add support for adding custom traits to models #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deegital
Copy link

I had the need to add additional traits to the models, in my case it was spatie's laravel-permission HasRules trait. This PR adds compatibility for the following syntax:

User:
    name: string
    traits:
      - Spatie\Permission\Traits\HasRoles

@jasonmccreary
Copy link
Collaborator

This is probably not something I'd add myself. However, since you have done the work, I am willing to if you can make some small changes:

  • Move traits under the existing meta property to minimize naming conflicts.
  • Ensure this is supported for controllers as well.

@deegital
Copy link
Author

Sounds good, I will add those changes!

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.

2 participants