title: Remembering Results When Navigating Back to Search Page in Laravel
body: <p>I have created a search page using Laravel that has "text to search" filters at the top. When the mouse is taken off the filter the page's JavaScript fires an Ajax call then returns the results. </p>
  
  <p>As I also have pagination enabled (with Ajax), when I click on page 2 (a link that looks like: <a href="http://project.test/customers?page=2" rel="nofollow noreferrer">http://project.test/customers?page=2</a>) the filters at the top keep any previously entered text, and the search results are <em>held</em>, which is just what I need!</p>
  
  <p>Now the problem:</p>
  
  <p>The database I have has two main tables. </p>
  
  <ol>
  <li><p>Customers</p></li>
  <li><p>Purchases</p></li>
  </ol>
  
  <p><strong>Relationships:</strong>
  A customer can have many purchases
  Any given purchase though belongs to a single customer</p>
  
  <p>I've built a search page so that the user can search for customers that match the given search criteria (e.g., those belonging to a particular city, or country, for example). </p>
  
  <p>In the table below the search filters that shows all the matching customer records, I have a column, with a purchases button that then takes the user to that particular customer's purchase page (here, the purchases button goes a link of the form project.test/customers/{{id}}</p>
  
  <p>The {id} goes through a route, that then loads a new page that shows all the purchases of that particular customer. </p>
  
  <p>Now, I have a "go back" button on this purchase page, that goes the following link:</p>
  
  <p>project.test/customers</p>
  
  <p>This then loads the original search page (but loads it afresh). </p>
  
  <p><strong>THIS IS THE PROBLEM!!!</strong></p>
  
  <p>Because the page is loaded afresh (using the link: project.test/customers)</p>
  
  <p>The search filters are cleared, and the page instead shows ALL the customers. And so, the user then has to re-enter all the search criteria again - which is annoying for the user, as he / she will often need to change a <strong><em>batch</em></strong> of purchase records, across a given set of customers, that match a given set of search criteria - and would rather not have to re-enter the same criteria, again, and again, when navigating away to a customer's purchase page, and then navigating back to the main search page.</p>
  
  <p>Given this problem, my question is, is it possible, conceptually, with Laravel, to go to another page, from a search page, and then, using some method to go back to the original search page, for the search filters, and results, showing from before, to still be there? - This would be a super useful thing to have!</p>
  
  <p>I've seen this done on other sites, possibly using other web technologies, but I'm just unsure how to start / where to begin to do this with Laravel / PHP?</p>
  
  <p>I appreciate any help, thanks in advance! </p>