@Snapey I don't see why a user would want to open 2 forms at once from 2 different places and fill both forms at once. But effectively it's a good observation.
@Snapey@jlrdw I also thought about a simple variable in my livewire component. I open the form and it will store the referer in a variable while mounting the component.
If I am on the show page and I click on the edit button, the referer URL is the one of the show page.
I fill the form and I click on the save button, but there are validation errors, the edit page is reloaded and the referer URL is now the edit page.
How can I return to the show page ?
I can't hard write the show page route for the redirection, because I can access the edit page also from the index page and not only from the show page.
I have found a solution : I can add the referer as a query parameter to the URL. So there isn't any problem with a session shared between 2 tabs.
I can edit the same model from two different pages, so no I don't know where to redirect.
I explain.
It's a personal project that helps me follow students in training.
I can display the student page (with all training sessions of this student) and I have another page with all training sessions in a month for all students.
I can edit a session from the student page or from the sessions page.
if I edit a session from the student page, I want to redirect back to the student page
if I edit a session from the sessions page, I want to redirect back to the sessions page