title: How to correctly return a JSON Response in Laravel?
body: <pre><code>    return response()-&gt;json([
          'message' =&gt; 'No new orders!'
      ]);
  </code></pre>
  
  <p>Unfortunately, this response is not working? Ideally, I'd like to return a JSON response with 'Message' => 'No new orders!' with a status code 204 No Content.</p>
  
  <p>I have these 2 included files in the controller...</p>
  
  <pre><code>use OhMyBrew\BasicShopifyAPI;
  use GuzzleHttp\Client;
  </code></pre>
  
  <p>This utilizes this built-in helper from <strong><em>vendor/laravel/framework/src/Illuminate/foundation/helpers.php</em></strong></p>
  
  <pre><code>if (! function_exists('response')) {
      /**
       * Return a new response from the application.
       *
       * @param  \Illuminate\View\View|string|array|null  $content
       * @param  int     $status
       * @param  array   $headers
       * @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory
       */
      function response($content = '', $status = 200, array $headers = [])
      {
          $factory = app(ResponseFactory::class);
  
          if (func_num_args() === 0) {
              return $factory;
          }
  
          return $factory-&gt;make($content, $status, $headers);
      }
  }
  </code></pre>