Exemplo n.º 1
0
 public function getList(Request $request)
 {
     $idCustomer = $request->input('idCustomer', Auth::customer()->user()->id);
     $table = Campania::leftJoin('customers', 'campania.customer_id', '=', 'customers.id')->select(['campania.id', 'customers.name_customer as cliente', 'campania.name', 'campania.url', 'campania.expiracion', 'campania.megas', 'campania.imagen', DB::raw("(if(campania.flagactive='1','Activo',(if(campania.flagactive='0','Inactivo','-')))) as flagactive")]);
     if ($idCustomer != 0) {
         $table = $table->whereCustomerId($idCustomer);
     }
     $table->orderBy('campania.id', 'desc');
     $datatable = Datatables::of($table)->editColumn('imagen', '<a target="_blank" href="{{$imagen}}"><img src="{{$imagen}}" heigth=64" width="64" /></a>')->addColumn('action', function ($table) {
         return '<a href="' . $table->id . '" class="btn btn-warning">Editar</a>
                     <a href="#" data-url="/admclient/' . self::NAMEC . '/delete/' . $table->id . '" class="btn btn-danger action_delete" data-id="' . $table->id . '" >Eliminar</a>';
     });
     return $datatable->make(true);
 }