Change URL::previous() to the actual route URL::route('index') or something, otherwise previous points to the previous page, and after submitting previous is '/page/create'
The validator can redirect using the back() method, Redirect::back()
briankip said:
Change URL::previous() to the actual route URL::route('index') or something, otherwise previous points to the previous page, and after submitting previous is '/page/create'
The validator can redirect using the back() method, Redirect::back()
First of all thanks for reply. The point is, that on index i have some kind of filter which is using URL parameters eg:
page/index?name=test&category=0
With "Go back" button on create page, i'm trying to return to index with these parameters, so the filter will be applied (still active).
Still didn't find solution. Any ideas?
I found the temporary solution is that you write query string into session everytime access to YourController@index by Session::push. Then, you put Session::get where you want to back to the list.
Hope that helps you. Tommy
Yes! you can use sessions instead of URL::previous()
//put key into session
Session::put('backUrl', URL::previous());
//get the key from session
Session::get('backUrl');
I don't think you should put the previous url in the session. I tried this in controller@create and it still does the same thing as it did before, since now it's setting the previous url (which is also the create) after the validation. So htdung83 is right and it should be in the controller@index. Then you should store the current url.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community