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. toRaw Method

you can use this method to render html content.

$datatable->column("image")->toRaw();

03. html Method

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

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

04. 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"
]);

05. 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");