Columns and Inputs Common Methods


01. label Method

You can use this method to set custom label for the column or input by default the label will be set from column or input name.

$datatable->column("created_at")->label("Created Date")->date();
$datatable->input("name")->label("User Name");

02. html Method

you can use this method to set custom column or input html.

$datatable->column("image")->html("Img: <img src='/|id|/|category.name.en|' />");
$datatable->input("hr")->html("<hr />");

03. attributes Method

you can use this method to set custom html tag attributes to the column or the input.

$datatable->column("id")->attributes([
    "class" => "btn btn-danger",
    "style" => "font-size: 20px"
]);

$datatable->input("name")->attributes([
    "class" => "form-control",
    "style" => "font-size: 20px"
]);

04. setAttribute Method

you can use this method to set custom html tag attribute to the column or the input.

$datatable->column("id")
    ->setAttribute("class", "btn btn-danger")
    ->setAttribute("style", "font-size: 20px");

$datatable->input("name")
    ->setAttribute("class", "form-control")
    ->setAttribute("style", "font-size: 20px");