I am trying to structure a large laravel application.
Trying to figure out:
1) Where does business rules / domain rules objects go?
2) How does business rules objects looks like?
By business rules I mean rules like. Given an invoice has possible states [new, approved, completed]. Only invoices in the "approved" state can be emailed to a customer. This is a simplified example.
Since there are a lot of these rules and these rules change often (once or twice a year), I would like to have them in dedicated classes.
This blog post https://stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel provides an application structure similar to my desired application structure. See below.
app/Domain/Invoices/
├── Actions
├── QueryBuilders
├── Collections
├── DataTransferObjects
├── Events
├── Exceptions
├── Listeners
├── Models
├── Rules
└── States
I'm somewhat familiar with domain driven design "theory". I am looking for code examples, preferably in Laravel or PHP (other languages are also ok). If anyone can point me to a github/gitlab project with code examples that would be great as well.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire