Guys iam working with a project Hotel Management System.
i have 3 functions in mycontroller PaymentController
//My routes
Route::resource('SupplierPayment', 'SupplierPaymentController');
Route::get('pay_form', 'SupplierPaymentController@pay_form')->name('pay_form');
Route::get('pay_bill', 'SupplierPaymentController@pay_bill')->name('pay_bill');
Route::get('payment_process', 'SupplierPaymentController@payment_process')->name('payment_process');
so when user selects the nav bar pay bills just it results an empty form where there will be two dates from and To. user will choose the payment date in the options and will click search Button. the it moves to pay_form method and fetches all the bills in the respective dates.
In each bill number i have a pay button, when i click the pay button it moves to pay_billmethod and brings the details of that bill and user will chose the date and mode of payment and the he will click submit button. then it goes to payment_process and the bill is paid.
Everything works fine. but my problem is after the user payment it redirects to pay_form method which shows an empty form. i didnt expect that, it should redirect to pay_bill method where it must shows the bills listed with the dates which is chosen before at the starting.
say for example i have chosen From :01-01-2020 To: 20-01-2020 means it fetches all bills, i will chose one specific bill and the i will pay the amount, but after that it should redirect to same page where 01-01-2020 to 20-01-2020 page only. so that user will choose another bill for payment.
now what hapens for me is after a bill payment the user need to choose the date once again to list the bills.
what i have tried is
public function index()
{
// first redirect to an empty form where it has only from to dates
}
public function pay_form(Request $request)
{
//fetch all bills with given form to dates
}
public function pay_bill(Request $request)
{
redirect to a form with only selected bill
}
public function payment_process(Request $request)
{
save to the db as paid with that selected bill
here is my problem now it should to redirect to ```pay_form``` method with already chosen dates. what i did is just
return redirect()->route('pay_form',$request); // but this not worked . i need to pass those dates once again to the same ```pay_form``` function
}
Kindly some one suggest your ideas please