title: Laravel datatable invalid JSON response
body: <p>Everything work fine on code below to fetch user logs:</p>
  
  <p>js:</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function () {
      var table =$('#systemLogs').DataTable({
          responsive: true,
          processing: true,
          serverSide: true,
          "language": {
              "url": "/datatables/media/plug-in/Persian.json"
          },
          ajax: '{!! url('/admin/systemLogs/data/systemLogsDataTable') !!}',
          columns: [
              { data: 'name', name: 'name' },
              { data: 'message_text', name: 'message_text' },
              { data: 'remote_addr', name: 'remote_addr' },
              { data: 'log_created_at', name: 'management_logs.created_at' },
              { data: 'log_updated_at', name: 'management_logs.updated_at' },
          ]
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>routes:</p>
  
  <pre><code>Route::get('/systemLogs/data/systemLogsDataTable','SystemLogsController@systemLogsDataTable');
  
  public function systemLogsDataTable()
  {
      $logs= ManagementLog::select('management_logs.message_text','management_logs.remote_addr','management_logs.created_at as log_created_at','management_logs.updated_at as log_updated_at','managements.name')-&gt;leftJoin('managements','management_logs.management_id','=','managements.id');
      return Datatables::of($logs)-&gt;make(true);
  }
  </code></pre>
  
  <p>It works fine for me but when I want to fetch just 2 fields from database it will give me </p>
  
  <blockquote>
    <p>DataTables warning:table id=systemLogs - invalid JSON response.</p>
  </blockquote>
  
  <p>but some times it will work ok.</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function () {
      var table =$('#systemLogs').DataTable({
          responsive: true,
          processing: true,
          serverSide: true,
          "language": {
              "url": "/datatables/media/plug-in/Persian.json"
          },
          ajax: '{!! url('/admin/systemLogs/data/systemLogsDataTable') !!}',
          columns: [
              { data: 'name', name: 'name' },
              { data: 'message_text', name: 'message_text' },
          ]
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I have understood which the problem is from middleware:</p>
  
  <pre><code>public function handle($request, Closure $next,$guard = 'admin')
  {
      if(!Auth::guard($guard)-&gt;check()){
          return redirect('/administrator/logout');
      }else{
          return $next($request);
      }
  }
  </code></pre>
  
  <p>when I changed it to:</p>
  
  <pre><code>public function handle($request, Closure $next,$guard = 'admin')
  {
      return $next($request);
  }
  </code></pre>
  
  <p>It works fine so it means the problem is from AJAX.
  what do I have to do?</p>