Support the ongoing development of Laravel.io →
Requests Views
Last updated 7 months ago.
0

Additional info:

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!

Last updated 7 months ago.
0

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.

Last updated 7 months ago.
0

I'm not sure how the session can help with anything, considering the progression of the reservation could take several weeks.

Last updated 7 months ago.
0

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: View::make(Str::slug($step));

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.

Last updated 7 months ago.
0

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)

Last updated 7 months ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

adamgoose adamgoose Joined 10 Dec 2013

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.