Msieprawski\ResourceTable\Generators\Table::body PHP Method

body() public method

Returns table body
public body ( ) : string
return string
    public function body()
    {
        $columns = $this->_getColumns();
        $body = '';
        $body .= '<tbody>';
        if (empty($this->_collection)) {
            // No results if collection is empty
            $body .= '<tr><td colspan="' . count($columns) . '">' . trans('resource-table::default.No_records') . '</td></tr>';
        } else {
            foreach ($this->_collection as $row) {
                // Generate each row
                $body .= '<tr>';
                foreach ($columns as $column) {
                    // Generate each column
                    $body .= '<td>';
                    $body .= $column->content($row);
                    $body .= '</td>';
                }
                $body .= '</tr>';
            }
        }
        $body .= '</tbody>';
        return $body;
    }