Each step has one or more "next steps". For example, when a Reservation is at "Quote" status, it has three actions: print quote, proceed to contract, and cancel. I am not sure how to best keep track of these available actions.
Note, this needs to be built to grow!
You can keep it in your session, use hidden inputs or create the Reservation after the first step and pass the ID along (or store the id in your session). I would create different actions for each step, not just the update action.
I'm not sure how the session can help with anything, considering the progression of the reservation could take several weeks.
You store the current step of the progress in the database, right? If it has a simple name slug-like name you can use it as the view name, using the examples you name you can have:
quote.blade.php, invoice.blade.php, contract-printed.blade.php, in-progress.blade.php, returned.blade.php, reviewed.blade.php, reported.blade.php, etc.
So you can use something like:
Then you may use view composers to inject the specific data you need on each view if you need to, effectively leaving all of this complex logic out of the controller.
Sorry, misunderstood your initial post. Why not just create different routes, controllers and views for each action? To make it easier in the view you can create a attribute on the model to generate a link to the active step, or redirect the edit route to the active step. You can also create some methods to generate a list of available actions or create some partial files you can include in each view (or the other way around)
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us