title: fetch multiple records for a same user id in laravel5.4
body: <p>I am writing function for webservices in laravel5.4. My input to the function is a user id and want to load all record which matches the user id in the Test table. Test table will have multiple record/test for the same userid. this below function returns only one user id record.Any suggestions on how to fetch multiple test records for same user id.For example,I have 30 test records for same userid 2.</p>
  
  <pre><code>public function LoadTest(Request $request)
  {
      $response = array();
      $response['status'] = 'error';
  
      if(($request-&gt;has('userid')) &amp;&amp; ($request-&gt;userid))
      {
          $userid= trim($request-&gt;input('userid'));
  
          $checkuserid= DB::table('user')
                        -&gt;where('user_id',$userid)
                        -&gt;get();
  
          if(!empty($checkuserid) &amp;&amp; $checkuserid-&gt;count() &gt; 0)  {
  
              $test= Test::find($userid);
              return response()-&gt;json($test); 
  
          } else {
              $response['message'] = 'Please enter valid user id.';
          }          
  
      }
      return response()-&gt;json($response);         
  }
  </code></pre>