title: Cannot use object of type Illuminate\Support\Facades\Request as array
body: <p>I have a problem with request I make to an api and I want a json return like this: </p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "message": "OK",
      "data": [
          User,
          ...
      ],
      "pager": {
          "current": integer,
          "total": integer
      }
  }
  </code></pre>
  
  <p>it's a list of user in my db.</p>
  
  <p>I use postman and I can't realy understand the problem I try to find a solution with google but nothing concrete. So I want to know what I'm doing wrong.</p>
  
  <pre><code>public function getListUser(Request $request)
  {
  
      $pseudo = $request["pseudo"];
      $perpage = $request["perpage"];
      $users = User
           ::select('username','pseudo','id','email')
           -&gt;where('pseudo','LIKE',$pseudo.'%')
           -&gt;paginate($perpage);
  
      return response()-&gt;json([
              'message'=&gt;'OK',
              'data'=&gt;$users-&gt;items(),
              'current'=&gt;$users-&gt;currentPage(),
              'total' =&gt; $users-&gt;lastpage()
              ]
       ,200);
  }
  </code></pre>
  
  <p>I try to get the params:</p>
  
  <p><a href="https://i.stack.imgur.com/TbPQF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TbPQF.png" alt="enter image description here"></a></p>