Donations Appreciated

Doing nothing for others is the undoing of ourselves. - Horace Mann

Click here to lend your support to: Laravel Datatables and make a donation at pledgie.com !

HtmlBuilderController.php - Html Builder with Plain Columns

IdNameEmailCreated AtUpdated At

Controller

public function getColumns(Datatables $datatables)
{
    $columns = ['id', 'name', 'email', 'created_at', 'updated_at'];

    if ($datatables->getRequest()->ajax()) {
        return $datatables->of(User::select($columns))->make(true);
    }

    $html = $datatables->getHtmlBuilder()->columns($columns);

    return view('datatables.html.columns', compact('html'));
}

View

@section('demo')
    {!! $html->table() !!}
@endsection

@section('scripts')
    {!! $html->scripts() !!}
@endsection