samedi 5 octobre 2019

Laravel 5.8 yajra datatables with a filter not functioning

I am trying to filter out data and present it in a table. My code in the controller that gets the data is

public function incompleteJobsData(Request $request)
      {
        $user = Auth::user();
        $cl = $user->client_id;
        $jb = DB::table('v_jobs')->where('client_id',$cl)->where('jobStatusID',2)->select(['id', 'status', 'customer_id', 'customer', 'operative','address','postcode','slug',jobStatusID]);
        return Datatables::of($jb)
           ->addColumn('action', function($pubs){
                           $btn = '<div style="float:right">
                           <a href="#" class="btn btn-outline-secondary btn-xs" title="show details" style="margin-right:.5em">View</a><a href="#" class="btn btn-outline-secondary btn-xs" title="show details" style="margin-right:.5em">edit</a></div>';
                            return $btn;
                    })
                ->make(true);
      }

It is filtering the first (client OK) but ignoring the second (jobStatusID) and resturning all the jobs not just those with an jobStatusID of 2.

Help appreciated/



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire