Where to put workflow code

Posted 2 months ago by christiant

Hi, just recently started to use laravel as a framework and still try to wrap my head around a few things. I want to build a application where I can work von a "case" and push it through a workflow.

What I have so far is the case-model and all relating models (mostly dimensions to the case-model). And from the nice laracast series I already built the maintenance of the dimensions with dedicated models, controllers and views (blades) for create/update/delete. So far everything nice and simple.

Now comes the part where I have to work on the "case". This includes for example that an agent will verify data entered or adds some information, in some states emails will be generated and responses will be entered.

In my "old" world every step had his dedicated php-file and in a very procedural way a form was presented, the agent actions have been handled and after a step was finished the next step (next php-File) started over again. In the database I saved in which step is the current for each case.

I was thinking about taking advantage of https://github.com/brexis/laravel-workflow and I understand how to configure the workflow-configuration, but I still don't have a feeling where to put the actual case processing into.

What I was thinking so far: Everything with a agent-interaction gets views, but would the handling of the triggerd actions (from the views) or saving the input all happen in the CaseModel which would lead to a big Model or would I build dedicated Controlers for the steps that include the functions "edit" and "store".

I guess that I could use events in transitions, e.g. when I wanted to send out an email notification, but this is just a tiny tasks in the case handling.

I am looking forward to your input

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.