title: How to query laravel collection result
body: <p>I get data-results from a stored procedureas Laravel collection. </p>
  
  <p>Data is like SQL table. Same keys (column names) inside the object of collection. </p>
  
  <p>Is there a way to query (raw SQL query) this collection and get the final result data I want?</p>
  
  <p>I looked into the <a href="https://laravel.com/docs/5.6/collections" rel="nofollow noreferrer">Laravel collection documentation</a> and I can run some methods to query the collection, but that is not raw SQL query(I need to run little complex raw SQL query on collection data.)</p>
  
  <ol>
  <li><p>Ideally, I need to create a temporary SQL table from the collection data. The collection can be different based on the result and need to create temp table based on that. </p></li>
  <li><p>I also looked into <code>Redis server</code> where I store my collection temporary and make a query, but don't find anything that I can store as SQL table and run SQL query on it. </p></li>
  <li><p>The third option would be storing the result data on <code>Web SQL</code> and run query but also required to download excel that is being done from the back end. </p></li>
  </ol>
  
  <p>Did anyone run into the similar issue? Maybe there is something else I can use for this issue. </p>