I am new to Laravel framework. I am using 4.2 my question is i had a pagination functionality in a manageemployee page, I have created a route for manageemployee page.
Route::get('/usercp/manageemployee',array('uses' =>'ManageEmployeeController@getManageCompanyEmployee','as' =>'getManageCompanyEmployee'));
In this page i have pagination , if user was in third page, he want to delete one record.
now the page looks like /usercp/manageemployee?page=3 After deleting a particular record in that page i need to redirect user to the same page.
My Redirect code as follows
return Redirect::route('getManageCompanyEmployee')->with('success','Record deleted successfully');
But with the above code user comes to the first page like /usercp/manageemployee. But after redirecting user needs to be in 3rd page /usercp/manageemployee?page=3.
How to acheive this?
Everything you pass to your route that is not a route parameters, becomes a route query automatically:
return Redirect::route('getManageCompanyEmployee', ['page' => 3])
->with('success','Record deleted successfully');
But you could also do:
return Redirect::refresh()->with('success','Record deleted successfully');
Keeping the user in the very same page.
Or
return Redirect::back()->with('success','Record deleted successfully');
Depending on your use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With