Skip to content

Commit 11fb5b9

Browse files
authored
Merge pull request #2949 from yajra/orchestra8
fix: bump orchestra/testbench to 8
2 parents 8e80b0a + 9b58d15 commit 11fb5b9

File tree

3 files changed

+50
-42
lines changed

3 files changed

+50
-42
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [8.0, 8.1]
17+
php: [8.1, 8.2]
1818
stability: [prefer-stable]
1919

2020
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
@@ -42,4 +42,4 @@ jobs:
4242
command: COMPOSER_ROOT_VERSION=dev-master composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
4343

4444
- name: Execute tests
45-
run: vendor/bin/phpunit --verbose
45+
run: vendor/bin/phpunit

composer.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
},
2424
"require-dev": {
2525
"nunomaduro/larastan": "^2.4",
26-
"orchestra/testbench": "^7.21",
26+
"orchestra/testbench": "^8",
2727
"yajra/laravel-datatables-html": "^9.3.4|^10"
2828
},
2929
"suggest": {
30+
"yajra/laravel-datatables-export": "Plugin for server-side exporting using livewire and queue worker.",
3031
"yajra/laravel-datatables-buttons": "Plugin for server-side exporting of dataTables.",
3132
"yajra/laravel-datatables-html": "Plugin for server-side HTML builder of dataTables.",
3233
"yajra/laravel-datatables-fractal": "Plugin for server-side response using Fractal.",
@@ -65,5 +66,11 @@
6566
"test": "vendor/bin/phpunit"
6667
},
6768
"minimum-stability": "dev",
68-
"prefer-stable": true
69+
"prefer-stable": true,
70+
"funding": [
71+
{
72+
"type": "github",
73+
"url": "https://github.com/sponsors/yajra"
74+
}
75+
]
6976
}

src/QueryDataTable.php

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ public function make($mDataSupport = true): JsonResponse
106106
}
107107
}
108108

109+
/**
110+
* Get paginated results.
111+
*
112+
* @return \Illuminate\Support\Collection<int, array>
113+
*/
114+
public function results(): Collection
115+
{
116+
return $this->query->get();
117+
}
118+
109119
/**
110120
* Prepare query by executing count, filter, order and paginate.
111121
*
@@ -123,7 +133,7 @@ protected function prepareQuery(): static
123133

124134
$this->prepared = true;
125135

126-
return $this;
136+
return $this;
127137
}
128138

129139
/**
@@ -146,9 +156,10 @@ public function prepareCountQuery(): QueryBuilder
146156
$builder = clone $this->query;
147157

148158
if ($this->isComplexQuery($builder)) {
149-
$table = $this->getConnection()->raw('('.$builder->toSql().') count_row_table');
150-
151-
return $this->getConnection()->table($table)->setBindings($builder->getBindings());
159+
return $this->getConnection()
160+
->query()
161+
->fromRaw('('.$builder->toSql().') count_row_table')
162+
->setBindings($builder->getBindings());
152163
}
153164

154165
$row_count = $this->wrap('row_count');
@@ -182,16 +193,6 @@ protected function wrap(string $column): string
182193
return $this->getConnection()->getQueryGrammar()->wrap($column);
183194
}
184195

185-
/**
186-
* Get paginated results.
187-
*
188-
* @return \Illuminate\Support\Collection<int, array>
189-
*/
190-
public function results(): Collection
191-
{
192-
return $this->query->get();
193-
}
194-
195196
/**
196197
* Keep the select bindings.
197198
*
@@ -309,6 +310,16 @@ protected function getBaseQueryBuilder($instance = null)
309310
return $instance;
310311
}
311312

313+
/**
314+
* Get query builder instance.
315+
*
316+
* @return QueryBuilder
317+
*/
318+
public function getQuery(): QueryBuilder
319+
{
320+
return $this->query;
321+
}
322+
312323
/**
313324
* Resolve the proper column name be used.
314325
*
@@ -524,20 +535,6 @@ public function orderByNullsLast(): static
524535
return $this;
525536
}
526537

527-
/**
528-
* Paginate dataTable using limit without offset
529-
* with additional where clause via callback.
530-
*
531-
* @param callable $callback
532-
* @return $this
533-
*/
534-
public function limit(callable $callback): static
535-
{
536-
$this->limitCallback = $callback;
537-
538-
return $this;
539-
}
540-
541538
/**
542539
* Perform pagination.
543540
*
@@ -558,6 +555,20 @@ public function paging(): void
558555
}
559556
}
560557

558+
/**
559+
* Paginate dataTable using limit without offset
560+
* with additional where clause via callback.
561+
*
562+
* @param callable $callback
563+
* @return $this
564+
*/
565+
public function limit(callable $callback): static
566+
{
567+
$this->limitCallback = $callback;
568+
569+
return $this;
570+
}
571+
561572
/**
562573
* Add column in collection.
563574
*
@@ -778,14 +789,4 @@ public function getFilteredQuery(): QueryBuilder
778789

779790
return $this->getQuery();
780791
}
781-
782-
/**
783-
* Get query builder instance.
784-
*
785-
* @return QueryBuilder
786-
*/
787-
public function getQuery(): QueryBuilder
788-
{
789-
return $this->query;
790-
}
791792
}

0 commit comments

Comments
 (0)