I have the next table..
The IDOP column is a key that I'm using for connect in my app instead of email... I would like to be able for filter the IDOP of each user... So the user should only be able to see the rows with of its corresponding IDOP, how could I filter only his IDOP?
this is the function of my datatable
$('#user_contactabilidadasesor').DataTable({
processing: true,
"scrollX": true,
//serverSide: true,
ajax: {
url: "",
},
columns: [
{
data: 'idop',
name: 'l.idop',
className: 'uniqueClassName'
},
{
data: 'idop_asesor',
name: 'idop_asesor',
searchable: false, render: function ( data, type, row ) {
              if (data == null){ return ''; }else{return (row['idop_asesor'] + ' ' + row['ape_asesor'])};
            },
className: 'uniqueClassName'
}
],
});
And this is my query
public function index(Request $request)
{
    if($request->ajax())
    {
        $data = DB::table('tbl_lista_contactabilidad as a')
    ->select('a.id','a.postventaatcs_id')
    ->leftjoin('tbl_equipo_postventaatcs as h','h.id','=','a.postventaatc_id')
    ->leftjoin('users as l','l.id','=','h.asesor_id')
    ->select(array('a.id','l.name as idop_asesor','l.apellido as ape_asesor','l.idop'));
        return DataTables::of($data)
                ->addColumn('action', function($data){
                    $button = '<button type="button" name="edit" id="'.$data->id.'" class="edit btn btn-primary btn-sm">Auditar</button>';
                    //$button .= '   <button type="button" name="edit" id="'.$data->id.'" class="delete btn btn-danger btn-sm">Delete</button>';
                    return $button;
                })
                ->rawColumns(['action'])
                ->make(true);
    }
    return view('contactabilidadasesor');
}
via Chebli Mohamed

Aucun commentaire:
Enregistrer un commentaire