| @@ 98-110 (lines=13) @@ | ||
| 95 | }); |
|
| 96 | ||
| 97 | /* @deprecated */ |
|
| 98 | Request::macro('fields', function (): Collection { |
|
| 99 | $fieldsParameter = config('query-builder.parameters.fields'); |
|
| 100 | ||
| 101 | $fieldsPerTable = collect($this->query($fieldsParameter)); |
|
| 102 | ||
| 103 | if ($fieldsPerTable->isEmpty()) { |
|
| 104 | return collect(); |
|
| 105 | } |
|
| 106 | ||
| 107 | return $fieldsPerTable->map(function ($fields) { |
|
| 108 | return explode(',', $fields); |
|
| 109 | }); |
|
| 110 | }); |
|
| 111 | ||
| 112 | /* @deprecated */ |
|
| 113 | Request::macro('sort', function ($default = null) { |
|
| @@ 79-92 (lines=14) @@ | ||
| 76 | }); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function fields(): Collection |
|
| 80 | { |
|
| 81 | $fieldsParameter = config('query-builder.parameters.fields'); |
|
| 82 | ||
| 83 | $fieldsPerTable = collect($this->query($fieldsParameter)); |
|
| 84 | ||
| 85 | if ($fieldsPerTable->isEmpty()) { |
|
| 86 | return collect(); |
|
| 87 | } |
|
| 88 | ||
| 89 | return $fieldsPerTable->map(function ($fields) { |
|
| 90 | return explode(',', $fields); |
|
| 91 | }); |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * @return array|string|null |
|