title: How can we add status code response when we hit a rest api?
body: <p>How can we be able to get a status code response if we are not able to pass the data on the api? I need your help guys I am completely new on this. Thanks in advance.</p>
  <p>contoller</p>
  <pre><code>...
  public function user(Request $request) {
  
      $params = [
          &quot;firstName&quot; =&gt; $request-&gt;firstname,
          &quot;lastName&quot; =&gt; $request-&gt;lastname,
      ];
  
      return $this-&gt;VoucherFactory-&gt;saveUser($params);
  
  }
  ...
  </code></pre>
  <p>VoucherFactory.php</p>
  <pre><code>...
  public function saveUser($params)
  {
      return $this-&gt;HttpClient-&gt;makeRequestPost($params, 'api/users', true);
      //status code response logic
  }
  ...
  </code></pre>