title: Yajra DataTable is not populating/Search for an easier way for search in tables and print to pdf function (Laravel)
body: <p>I want to display a DataTable of job applications with an application_status_id of 8, meaning completed applications where the jobseeker has been deployed. I'm very new to DataTables in Laravel and PHP, and I've only been following this tutorial: <a href="https://www.youtube.com/watch?v=ZqPzSIK2N-Y" rel="nofollow noreferrer">https://www.youtube.com/watch?v=ZqPzSIK2N-Y</a>
  However, Nothing's showing up, only the table headings.</p>
  <p>I'm also having trouble on how I can display column data that are related to another table, which are</p>
  <pre><code>application_status_id = jobApplication-&gt;step-&gt;name
  jobseeker_id = jobApplication-&gt;jobseeker-&gt;getFullNameAttribute()
  jobpost_id = jobApplication-&gt;jobPost-&gt;job_position
  </code></pre>
  <p>jobApplicationDataTable</p>
  <pre><code>class jobApplicationDataTable extends DataTable
  {
      /**
       * Build DataTable class.
       *
       * @param mixed $query Results from query() method.
       * @return \Yajra\DataTables\DataTableAbstract
       */
      public function dataTable($query)
      {
          return datatables()
              -&gt;eloquent($query)
              -&gt;addColumn('action', 'jobapplication.action');
      }
  
      /**
       * Get query source of dataTable.
       *
       * @param \App\Models\jobApplication $model
       * @return \Illuminate\Database\Eloquent\Builder
       */
      public function query(jobApplication $model)
      {
          return $model-&gt;newQuery()-&gt;where('application_status_id','=',8)-&gt;with(['step','jobseeker','jobPost']);
      }
  
      /**
       * Optional method if you want to use html builder.
       *
       * @return \Yajra\DataTables\Html\Builder
       */
      public function html()
      {
          return $this-&gt;builder()
                      -&gt;setTableId('jobapplication-table')
                      -&gt;columns($this-&gt;getColumns())
                      -&gt;minifiedAjax()
                      -&gt;orderBy(1)
                      -&gt;buttons(
                          // Button::make('create'),
                          Button::make('export'),
                          Button::make('print'),
                          // Button::make('reset'),
                          // Button::make('reload')
                      );
      }
  
      /**
       * Get columns.
       *
       * @return array
       */
      protected function getColumns()
      {
          return [
              // Column::computed('action')
              //       -&gt;exportable(false)
              //       -&gt;printable(false)
              //       -&gt;width(60)
              //       -&gt;addClass('text-center'),
              'id',
              'name' =&gt; new \Yajra\DataTables\Html\Column(['title' =&gt; &quot;Applicant Name&quot;,'data' =&gt; 'jobseeker.getFullNameAttribute','name' =&gt; 'jobseeker'])
          ];
      }
  
      /**
       * Get filename for export.
       *
       * @return string
       */
      protected function filename()
      {
          return 'jobApplication_' . date('YmdHis');
      }
  </code></pre>
  <p>web.php</p>
  <pre><code>Route::get('/employee/fordeployment',[employeeController::class,'viewDeployedApplicants'])-&gt;middleware(['auth','employee'])-&gt;name('deployed-list');
  </code></pre>
  <p>Controller:</p>
  <pre><code>    public function viewDeployedApplicants(jobApplicationDataTable $dataTable){
           return $dataTable-&gt;render('employee.view-deployed-applicants');
      }
  </code></pre>
  <p>View:</p>
  <pre><code>&lt;x-admin.admin-layout&gt;
      &lt;head&gt;
  
          &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;https://cdn.datatables.net/v/bs4/dt-1.11.3/b-2.1.1/b-html5-2.1.1/date-1.1.1/r-2.2.9/datatables.min.css&quot;/&gt;
  
          &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js&quot;&gt;&lt;/script&gt;
          &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js&quot;&gt;&lt;/script&gt;
          &lt;script type=&quot;text/javascript&quot; src=&quot;https://cdn.datatables.net/v/bs4/dt-1.11.3/b-2.1.1/b-html5-2.1.1/date-1.1.1/r-2.2.9/datatables.min.js&quot;&gt;&lt;/script&gt;
  
      &lt;/head&gt;
      &lt;section class=&quot;content&quot; style=&quot;margin-left: 18em; margin-top: 5em; margin-right: 2em;&quot;&gt;
          &lt;h3&gt; Deployed Applicants &lt;/h3&gt;
          &lt;div class=&quot;row input-daterange&quot;&gt;
              &lt;div class=&quot;col-md-4&quot;&gt;
                  &lt;input type=&quot;date&quot; name=&quot;from_date&quot; id=&quot;from_date&quot; class=&quot;form_control&quot; placeholder=&quot;From&quot;&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-4&quot;&gt;
                  &lt;input type=&quot;date&quot; name=&quot;to_date&quot; id=&quot;to_date&quot; class=&quot;form_control&quot; placeholder=&quot;To&quot;&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-4&quot;&gt;
                  &lt;button type=&quot;button&quot; name=&quot;filter&quot; class=&quot;btn btn-success&quot;&gt;Filter&lt;/button&gt;
                  &lt;button type=&quot;button&quot; name=&quot;refresh&quot; class=&quot;btn btn-success&quot;&gt;Refresh&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;row&quot;&gt;
              &lt;div class=&quot;col-md-12&quot;&gt;
                  {!! $dataTable-&gt;table() !!}
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;/x-admin.admin-layout&gt;
  </code></pre>
  <p>I'm very new to datatables and I've been stuck here for hours. I have to add more features such as select records by to and from date, and export to pdf. But I have no idea where to start debugging. There aren't many resources on what I want to accomplish. What's wrong with my code? Is there a simpler way to approach this without the package?</p>