[ad_1]
Indeed using {{ URL:previous() }}
do work, but if you’re using a same named route to display multiple views, it will take you back to the first endpoint of this route.
In my case, I have a named route, which based on a parameter selected by the user, can render 3 different views. Of course, I have a default case for the first enter in this route, when the user doesn’t selected any option yet.
When I use URL:previous()
, Laravel take me back to the default view, even if the user has selected some other option. Only using javascript inside the button I accomplished to be returned to the correct view:
<a href="https://stackoverflow.com/questions/12333739/javascript:history.back()" class="btn btn-default">Voltar</a>
I’m tested this on Laravel 5.3, just for clarification.
[ad_2]