File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 3131 - [Fractal Transformer](/docs/{{package}}/{{version}}/response-fractal)
3232 - [Fractal Serializer](/docs/{{package}}/{{version}}/response-fractal-serializer)
3333 - [Additional Data Response](/docs/{{package}}/{{version}}/response-with)
34+ - [Only Columns](/docs/{{package}}/{{version}}/response-only)
3435
3536- ## Column Editing
3637 - [Add Column](/docs/{{package}}/{{version}}/add-column)
Original file line number Diff line number Diff line change 1+ # Only Response
2+
3+ Get only selected columns in response.
4+
5+ ``` php
6+ use DataTables;
7+
8+ Route::get('user-data', function() {
9+ $model = App\User::query();
10+
11+ return DataTables::eloquent($model)
12+ ->only(['id','name'])
13+ ->toJson();
14+ });
15+ ```
16+
17+ <a name =" response " ></a >
18+ ## Example Response
19+
20+ ``` json
21+ {
22+ "draw" : 2 ,
23+ "recordsTotal" : 10 ,
24+ "recordsFiltered" : 2 ,
25+ "data" : [{
26+ "id" : 476 ,
27+ "name" : " Esmeralda Kulas"
28+ }, {
29+ "id" : 6 ,
30+ "name" : " Zachery Muller"
31+ }]
32+ }
33+ ```
You can’t perform that action at this time.
0 commit comments