title: Laravel rate limit to return a JSON payload
body: <p>I'm building an API on top of Laravel. I'd like to use the built in rate limiting capabilities by using the <code>Throttle</code> middleware.</p>
  
  <p>Problem is, when the throttle middleware triggers the response is:</p>
  
  <pre><code>// Response headers
  Too Many Attempts.
  </code></pre>
  
  <p>My API uses an error payload in JSON that looks like the following:</p>
  
  <pre><code>// Response headers
  {
    "status": "error",
    "error": {
      "code": 404,
      "message": "Resource not found."
    }
  }
  </code></pre>
  
  <p>What is the best way to get the <code>Throttle</code> middleware to return an output in the manner I require?</p>