Laravel查询与彩色按钮

I am really new using Laravel 4. I have a very simple problem here.

I am calling this query with this.

$users = DB::table('alumnos')->select(array('id', 'Nombre', 'Apellidos','Seccion','Grado','Preceptor','P1','P2','P3','P4','P5','P6','P7','P8'));
return Datatables::of($users)

And I am populating a table like this:

  +--------+-----------+------------+
  | Nombre | Apellidos |    P1      |
  +--------+-----------+------------+
  |Nombre 1|Apellido1  |    0       | 
  |Nombre 1|Apellido1  |    1       |    
  |Nombre 1|Apellido1  |    0       |     
  |Nombre 1|Apellido1  |    1       |    
  |Nombre 1|Apellido1  |    1       |    
  |Nombre 1|Apellido1  |    1       |   
  +--------+-----------+------------+

The table is populated using javascript code:

var oTable;
    $(document).ready(function() {
            oTable = $('#registros').dataTable( {
            "sDom": "<l><f><r>t<i><p>",
            "sPaginationType": "bootstrap",
            "oLanguage": {
                "sSearch": "Search:",
                "sLengthMenu": "_MENU_ records per page"
            },
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "{{ URL::to('registrar/datadirectivos') }}"
        });

        $("#users_filter input").addClass("form-control inline-control input-sm");
        $("#users_length select").addClass("form-control inline-control");
    });

What I want to do is change the last column named Preceptoria, that instead of numbers the column show buttons dinamically colored depending if its 1 a button colored in green and if its 0 a button colored in red.

I already resolve it.

I changed the javascript code:

$(document).ready(function() {
oTable = $('#registros').dataTable( {
            "sDom": "<l><f><r>t<i><p>",
            "sPaginationType": "bootstrap",
            "oLanguage": {
                "sSearch": "Search:",
                "sLengthMenu": "_MENU_ records per page"
            },"fnRowCallback": function( nRow, aData, iDisplayIndex,iDisplayIndexFull) {
            $(nRow).children().each(function(index, td) {
                        if(index == 5 || index == 6 || index == 7 || index == 8 || index == 9 || index == 10 || index == 11 || index == 12)  {
                            if ($(td).html() === "0") {
                                $(td).html("<button class='btn' style='background-color:#A8383B;'>P1</button>");
                            } 
                             if ($(td).html() === "1") {
                                $(td).html("<button class='btn' style='background-color:#3C8D2F;'>P1</button>");
                            }                                        
                        }
            });                       
    return nRow;
  },
            "bProcessing": true,
           "bServerSide": true,
           "sAjaxSource": "{{ URL::to('registrar/datadirectivos') }}"
        });
        $("#users_filter input").addClass("form-control inline-control input-sm");
        $("#users_length select").addClass("form-control inline-control");
    });