Yajra\Datatables\Html\Builder::table PHP Method

table() public method

Generate DataTable's table html.
public table ( array $attributes = [], boolean $drawFooter = false ) : string
$attributes array
$drawFooter boolean
return string
    public function table(array $attributes = [], $drawFooter = false)
    {
        $this->tableAttributes = array_merge($this->tableAttributes, $attributes);
        $th = $this->compileTableHeaders();
        $htmlAttr = $this->html->attributes($this->tableAttributes);
        $tableHtml = '<table ' . $htmlAttr . '>';
        $tableHtml .= '<thead><tr>' . implode('', $th) . '</tr></thead>';
        if ($drawFooter) {
            $tf = $this->compileTableFooter();
            $tableHtml .= '<tfoot><tr>' . implode('', $tf) . '</tr></tfoot>';
        }
        $tableHtml .= '</table>';
        return $tableHtml;
    }

Usage Example

コード例 #1
0
 /**
  * Возвращает html-код таблицы.
  *
  * @param array $attributes
  *
  * @return string
  */
 public function show(array $attributes = [])
 {
     $this->buildIfNotBuilt();
     return $this->html->table($attributes);
 }