title: Laravel Cache Raw Queries
body: <p>I have a repository with a number of raw queries, for example:</p>
  
  <pre><code>DB::select(DB::raw(
               'SELECT stuffFields
                FROM stuffTable
                A NUMBER OF COMPLEX JOINS, ETC'
            ));
  </code></pre>
  
  <p>I would like to cache the results from this query, but I encountered a couple of issues:</p>
  
  <p>1) I cannot do ->remember(60), as the Fluent query is not started with the table() method.</p>
  
  <p>2) I cannot do</p>
  
  <pre><code>DB::table('stuffTable')
            -&gt;select(DB::raw(
               'stuffFields
                A NUMBER OF COMPLEX JOINS, ETC'
            ))-&gt;get();
  </code></pre>
  
  <p>because there are those joins and the FROM clause is getting appended at the end of the query (after the joins), and this throws an SQL syntax error.</p>
  
  <p>I also cannot bring out the joins in a join() method, as they contain nested queries (is there a way to perform rawJoin()...i couldn't find anything like that?).</p>
  
  <p>Can anyone suggest a way to either restructure the Fluent calls or a common way to cache such raw queries?</p>