File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ We can now extend and reuse our DataTable class inside our controller by using `
44
55> IMPORTANT: Extended DataTable is only applicable on ` ^1.1 ` and above.
66
7-
87## Upgrading from v1.0 to v1.1
8+
99- Upgrade to ` laravel-datatables-buttons:^1.1 `
1010- Rename ` ajax() ` method to ` dataTable() `
1111- Remove ` ->toJson() ` from the method chain.
3333```
3434
3535## Quick Example:
36+
3637``` php
3738Route::get('datatable', function(RolesDataTable $dataTable){
3839 return $dataTable->before(function (\Yajra\DataTables\DataTableAbstract $dataTable) {
@@ -54,3 +55,19 @@ Route::get('datatable', function(RolesDataTable $dataTable){
5455 ->render('path.to.view');
5556});
5657```
58+
59+ ## Passing data to DataTable class
60+
61+ You can pass data from Controller to DataTable class using ` with ` api.
62+
63+ ``` php
64+ Route::get('datatable', function(RolesDataTable $dataTable){
65+ return $dataTable
66+ ->with('key', 'value')
67+ ->with([
68+ 'key2' => 'value2',
69+ 'key3' => 'value3',
70+ ])
71+ ->render('path.to.view');
72+ });
73+ ```
You can’t perform that action at this time.
0 commit comments