title: Laravel returning intergers in json response
body: <p>i am using </p>
  
  <pre><code>$user = User::find($user_id);
  return response()-&gt;json(array('user'=&gt;$user),200);
  </code></pre>
  
  <p>On local server with php5.9 it returns all the keys except id as string.</p>
  
  <pre><code>{
      "success": "1",
      "message": "success",
      "user": {
          "id": 75,
          "name": "",
          "postal_code": "73733",
      }
  }
  </code></pre>
  
  <p>But the same code on production server with php7.0 returns other keys as of type integer ex. check this postal_code value.</p>
  
  <pre><code>{
      "success": "1",
      "message": "success",
      "user": {
          "id": 75,
          "name": "",
          "postal_code": 73733,
      }
  }
  </code></pre>
  
  <p>So solve this i am using <code>$cast=[]</code> in User.php.</p>
  
  <p>But i have used raw queries also. What is the best way to convert all the values in response json to be of string type.</p>