title: Why is laravel (eloquent) caching last response from api route?
body: <p>I'm building reactive dashboard with Laravel / VueJS. When dashboard is working and socket connection is up, my idea is to synchronize all clients with same userId and after reconnecting I'm sending request to the endpoint and I'm <code>synchronized</code> again. The synchronization is needed beacause all users can actually change some configurations to dashboard like chosing grid items or resize them or drag them into another place.</p>
  
  <p>I'm challenging the issue when after reconnecting to sockets I'm firing request to database to get the data again and I'm getting the same response as I did for the init request. Data is not updated. </p>
  
  <p>But when I disconnect again and connect once more. Data is synchronized again. And I'm getting data updated for the second call.</p>
  
  <p>I tohught thats because of Cache-control headers but It grants nothing to me.</p>
  
  <p>I tried to change headers on api.</p>
  
  <pre><code>return response()-&gt;json($response, 200, [
      'Cache-Control' =&gt; 'no-cache, no-store, must-revalidate'
  ]);
  </code></pre>
  
  <p>And for axios: </p>
  
  <pre><code>axios.get(payload.url, {
      headers: {
          'Content-Type': 'application/json',
          'Cache-Control' : 'no-cache, no-store, must-revalidate'
      }
  }).then( response =&gt; {
  </code></pre>
  
  <p>But it still doesnt work.</p>
  
  <p>My eloquent call is:</p>
  
  <pre><code>$dashboards = Dashboard::where(
          'user_id', '=', $userId
      )-&gt;with([
      'layouts',
      'components' =&gt; function($query) {
          $query-&gt;with('config')-&gt;with('type');
      }
  ])-&gt;get();
  </code></pre>
  
  <p>Headers for first call are like:</p>
  
  <pre><code>Cache-Control: must-revalidate, no-cache, no-store, private
  Connection: Keep-Alive
  Content-Length: 2564
  Content-Type: application/json
  Date: Sat, 26 May 2018 12:06:34 GMT
  Keep-Alive: timeout=5, max=96
  Server: Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1
  X-Powered-By: PHP/7.2.1
  X-RateLimit-Limit: 100
  X-RateLimit-Remaining: 90
  </code></pre>
  
  <p>For the second call I'm getting </p>
  
  <pre><code>Cache-Control: must-revalidate, no-cache, no-store, private
  Connection: Keep-Alive
  Content-Length: 2564
  Content-Type: application/json
  Date: Sat, 26 May 2018 12:07:29 GMT
  Keep-Alive: timeout=5, max=100
  Server: Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1
  X-Powered-By: PHP/7.2.1
  X-RateLimit-Limit: 100
  X-RateLimit-Remaining: 94
  </code></pre>
  
  <p>Why is this synchronization works for the second request not for the first?</p>