title: Call to a member function getQuery() on array
body: <p>Trying to do with datatables in laravel:</p>
  
  <p><strong>Error:</strong> <strong>Call to a member function getQuery() on array</strong> in laravel datatables</p>
  
  <p><strong>Here is Laravel Code:</strong>
  Controller:</p>
  
  <pre><code>public function get_all_course_requests() {
          $course_request = new CourseRequest();
          $request_details = $course_request-&gt;get_all_course_requests();
          $i = 0;
          foreach ($request_details as $request) {
              $request_details[$i]-&gt;sr_no = $request-&gt;id;
              $request_details[$i]-&gt;l_fname = $request-&gt;l_fname;
              $request_details[$i]-&gt;l_lname = $request-&gt;l_lname;
              $request_details[$i]-&gt;l_mail = $request-&gt;l_mail;
              $request_details[$i]-&gt;name = $request-&gt;name;
              $request_details[$i]-&gt;request_date = $request-&gt;request_date;
              $request_details[$i]-&gt;action = $request-&gt;id;
              $i++;
          }
          return Datatables::of($request_details)
                          -&gt;filterColumn('l_fname', 'l_lname', 'name','course_name','request_date')
                          -&gt;make(true);
      }
  </code></pre>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>function get_all_course_requests($status='0') {
        //  DB::enableQueryLog();
          $course_request = new CourseRequestModel;
          $my_team_ids = $course_request-&gt;get_my_team_learner_ids();
         return  DB::table('course_request')               
                  -&gt;select('login_details.l_fname','login_details.l_lname','login_details.l_mail','course_request.id','multilevel_course.name','course_request.request_date')
                  -&gt;whereIn('login_details.l_id', $my_team_ids)
                  -&gt;where('course_request.status', $status)
                  -&gt;join('login_details', 'login_details.l_id','=', 'course_request.user_id')
                  -&gt;join('multilevel_course', 'multilevel_course.id','=','course_request.course_id')
                  -&gt;whereIn('enrollment_policy',array('2','3') )
                  -&gt;get();
  
      }
  </code></pre>
  
  <p>Here is JS Code:</p>
  
  <pre><code>$(function() {
      $('#course_requests_table').DataTable({
          processing: true,
          serverSide: true,
          ajax: BASE_URL + '/get_course_requests',
          order: [],
          columns: [
              {data: "view", orderable: false,
                  render: function(data, type, row) {
                      return '&lt;input type="checkbox" class="case" name="row_ids[]" value="' + data + '"&gt;';
                  }
              },
              {data: 'l_fname', name: 'l_fname'},
              {data: 'l_lname', name: 'l_lname'},
              {data: 'l_mail', name: 'l_mail'},
              {data: 'name', name: 'name'},
              {data: 'request_date', name: 'request_date'},
              {data: 'action', orderable: false,
                  render: function(data, type, row) {
                      return '&lt;a style="cursor:pointer" OnClick="delete_mail(' + data + ')"&gt;&lt;i class="fa fa-trash"&gt;&lt;/i&gt;&lt;/a&gt;';
                  }
              }
          ]
      });
  });
  </code></pre>
  
  <p><strong>Whats going wrong with code? and what to be done to solve this?</strong></p>