Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kay899's avatar

Overriding proteced $tableAttributes from a Datatables class?

Hi, I am using this package for building DataTables with Laravel:

https://github.com/yajra/laravel-datatables

I am doing some scaffolding stuff with that package here, which also provides the stuff for DataTables within it:

https://github.com/InfyOmLabs/generator-builder

Now I want to have my DataTables formated in Bootstrap3 bordered and striped tables. The Datatables/Html/Builder class has a protected tableAttributes for it, which I now would like to overwrite

http://laravel.io/bin/mGojP

Here is my Models Datatables Class where in the html() function I can set several attributes for colums, parameters etc. I suppose somehow I could also overwrite the class for the table but I don't know how:

http://laravel.io/bin/YywEy

Hope someone could help me.

Thanks kay899

0 likes
1 reply
kay899's avatar

ok, finally I found it in a view:

{!! $dataTable->table(['class' => 'table table-bordered table-striped', 'width' => '100%']) !!}

Please or to participate in this conversation.