title: Call to a member function toJson() on a non-object Laravel 5.0
body: <p>From below code reference, I am joining the users table, <code>user_details</code> table and <code>user_config</code> table with each record similar key and no problem with that (it works), yet when I'm trying to convert the result records to json array, it gives me this error</p>
  
  <blockquote>
    <p>Call to a member function toJson() on a non-object</p>
  </blockquote>
  
  <pre><code>public function get_users_table(){
         $users = DB::table('users')
          -&gt;join('user_details', 'users.id', '=', 'user_details.id')
          -&gt;join('user_config', 'users.id', '=', 'user_config.id')
          //-&gt;select('users.*', 'contacts.phone', 'orders.price')
          -&gt;get()-&gt;toJson();
  
         return response()-&gt;json(['success' =&gt; true, 'users' =&gt; $users]);
      }
  </code></pre>
  
  <p>Any ideas, help?</p>