I have an appointments page where I keep track of my appointments. I have several dropdowns which I use to filter things, for example which month I want to see, or which appointments with a certain status or label. Once I select a different value in either one of the dropdowns, the form is submitted and the following method is called:
public function post(Request $request)
{
$request_month = $request->input('month');
$request_year = $request->input('year');
if($request_month)
{
$request->session()->put('month', $request_month);
}
if($request_year)
{
$request->session()->put('year', $request_year);
}
return Redirect::to('appointments');
}
This is a simplified version of what I actually have. What this basically does is, check if a value has been submitted for either one of the dropdowns, and if so, store that value in a session. Then, redirect back to my appointments view where I gather all data using the values that has been stored in the session.
Everything works, but I was wondering if this is good practice (I think not) and how I could improve this or write this better. How would you do something like this?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community