Answer the question
In order to leave comments, you need to log in
How to properly implement workflows in Laravel?
Hello dear.
There is an application in which for one of the models it is necessary to configure staged work with instances, where each of the stages is performed by a user who has the right to do so, and the instance itself is in a state that will allow this stage to be completed.
For example, there is a model with blog posts. If the user's role is "writer" and the post's status is "new", then the user has access to the step where the post itself can be written. After that, the status changes to "under review" and the user with the admin role must make changes to the post and publish it, thereby changing the status to "done". The example is simplified, but the essence is the same.
In Symfony, there is a ready-made solution of the same name for this, and there is a transfer of this solution to Laravel. But while studying, it became clear to me that in the case of my application, most of the library's functionality simply will not be used. And here a dilemma is born - to use the library so as not to reinvent the wheel or implement it yourself. In fact, you only need to check the ability to start the workflow at each stage and step by step work with the data.
If you are inclined to the second option, then tell me how and where in the context of the file structure it is better to implement it. Is it worth keeping all this logic in the model or is it better to put it in a separate place?
Thanks
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question