lunarstorm/laravel-ddd

Implement `HasDomainFactory` trait

Closed this issue · 0 comments

Action item:

  • Refactor the current domain model factory implementation as a portable HasDomainFactory trait instead

Discussed in #30

Originally posted by meditto August 17, 2023
Hello, I hope you're all doing well. I've been using laravel-ddd for the past few days and have found it to be a valuable tool for my Laravel projects. I'd like to suggest a feature enhancement that I believe could further improve the package's usability.
The current process involves generating the BaseMdel. I believe this process could be simplified and made more user-friendly by introducing a new trait, HasDDDFactory.

The proposed HasDDDFactory trait would serve as a drop-in replacement for the existing HasFactory trait. It would automatically handle the detection of the appropriate factory path just like the BaseModel.

The flexibility of the HasDDDFactory trait could also extend to models that don't directly extend the Model object, such as the User model. This adaptability adds to its potential usefulness.

image

I would greatly appreciate your thoughts and insights on this proposal.