Skip to content

Commit 6484f30

Browse files
authored
Merge pull request #6 from kjsoftware/feature/EPBASIC-2370
Feature/epbasic 2370
2 parents 56c9005 + e535a1e commit 6484f30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1135
-389
lines changed

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
- name: Dependabot metadata
1515
id: metadata
16-
uses: dependabot/fetch-metadata@v1.3.6
16+
uses: dependabot/fetch-metadata@v2.1.0
1717
with:
1818
github-token: "${{ secrets.GITHUB_TOKEN }}"
1919
compat-lookup: true

.github/workflows/php-cs-fixer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
ref: ${{ github.head_ref }}
1414

@@ -18,6 +18,6 @@ jobs:
1818
args: --config=.php_cs.dist.php --allow-risky=yes
1919

2020
- name: Commit changes
21-
uses: stefanzweifel/git-auto-commit-action@v4
21+
uses: stefanzweifel/git-auto-commit-action@v5
2222
with:
2323
commit_message: Fix styling

.github/workflows/phpstan.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon.dist'
8+
9+
jobs:
10+
phpstan:
11+
name: phpstan
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.2'
20+
coverage: none
21+
22+
- name: Install composer dependencies
23+
uses: ramsey/composer-install@v3
24+
25+
- name: Run PHPStan
26+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/run-tests.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
name: run-tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- '.github/workflows/run-tests.yml'
8+
- 'phpunit.xml.dist'
9+
- 'composer.json'
10+
- 'composer.lock'
411

512
jobs:
613
test:
714
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 5
816
strategy:
9-
fail-fast: false
17+
fail-fast: true
1018
matrix:
1119
os: [ubuntu-latest]
12-
php: [8.2, 8.1, 8.0]
13-
laravel: [9.*, 10.*]
14-
stability: [prefer-lowest, prefer-stable]
20+
php: [8.3, 8.2]
21+
laravel: [10.*, 11.*]
22+
stability: [prefer-stable]
1523
include:
16-
- laravel: 10.*
17-
testbench: 8.*
18-
carbon: ^2.63
19-
- laravel: 9.*
20-
testbench: 7.*
24+
- laravel: 11.*
25+
testbench: 9.*
2126
carbon: ^2.63
22-
exclude:
2327
- laravel: 10.*
24-
php: 8.0
28+
testbench: 8.*
2529

2630
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2731

@@ -48,10 +52,8 @@ jobs:
4852
--health-retries 5
4953
5054
steps:
51-
52-
5355
- name: Checkout code
54-
uses: actions/checkout@v3
56+
uses: actions/checkout@v4
5557

5658
- name: Setup PHP
5759
uses: shivammathur/setup-php@v2
@@ -67,7 +69,7 @@ jobs:
6769
6870
- name: Install dependencies
6971
run: |
70-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
72+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
7173
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
7274
7375
- name: Execute tests

.github/workflows/update-changelog.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
with:
1515
ref: main
1616

@@ -21,7 +21,7 @@ jobs:
2121
release-notes: ${{ github.event.release.body }}
2222

2323
- name: Commit updated CHANGELOG
24-
uses: stefanzweifel/git-auto-commit-action@v4
24+
uses: stefanzweifel/git-auto-commit-action@v5
2525
with:
2626
branch: main
2727
commit_message: Update CHANGELOG

.phpunit.cache/test-results

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,143 @@
22

33
All notable changes to `laravel-query-builder` will be documented in this file
44

5+
## 6.0.1 - 2024-05-21
6+
7+
### What's Changed
8+
9+
* Fix ability to filter models by an array as filter value by @inmula in https://github.com/spatie/laravel-query-builder/pull/943
10+
11+
### New Contributors
12+
13+
* @inmula made their first contribution in https://github.com/spatie/laravel-query-builder/pull/943
14+
15+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/6.0.0...6.0.1
16+
17+
## 6.0.0 - 2024-05-10
18+
19+
### What's Changed
20+
21+
* Add additional types & Phpstan by @Nielsvanpach in https://github.com/spatie/laravel-query-builder/pull/910
22+
23+
### New Contributors
24+
25+
* @Nielsvanpach made their first contribution in https://github.com/spatie/laravel-query-builder/pull/910
26+
27+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.8.1...6.0.0
28+
29+
## 5.8.1 - 2024-05-10
30+
31+
### What's Changed
32+
33+
* Fix typo by @justinkekeocha in https://github.com/spatie/laravel-query-builder/pull/926
34+
* List query-builder-ts front-end implementation package by @rogervila in https://github.com/spatie/laravel-query-builder/pull/925
35+
* Fix incorrect escape character in SQL for LIKE query in partial filter by @Talpx1 in https://github.com/spatie/laravel-query-builder/pull/927
36+
37+
### New Contributors
38+
39+
* @justinkekeocha made their first contribution in https://github.com/spatie/laravel-query-builder/pull/926
40+
* @rogervila made their first contribution in https://github.com/spatie/laravel-query-builder/pull/925
41+
* @Talpx1 made their first contribution in https://github.com/spatie/laravel-query-builder/pull/927
42+
43+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.8.0...5.8.1
44+
45+
## 5.8.0 - 2024-02-06
46+
47+
### What's Changed
48+
49+
* [Docs] Update config file content by @shdehnavi in https://github.com/spatie/laravel-query-builder/pull/918
50+
* Bump: Deprecating Laravel 9 and PHP 8.1, adding Laravel 11 support by @JustSteveKing in https://github.com/spatie/laravel-query-builder/pull/922
51+
52+
### New Contributors
53+
54+
* @shdehnavi made their first contribution in https://github.com/spatie/laravel-query-builder/pull/918
55+
* @JustSteveKing made their first contribution in https://github.com/spatie/laravel-query-builder/pull/922
56+
57+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.7.0...5.8.0
58+
59+
## 5.7.0 - 2024-01-08
60+
61+
### What's Changed
62+
63+
* Start testing against PHP 8.3 by @sergiy-petrov in https://github.com/spatie/laravel-query-builder/pull/899
64+
* Add the possibility to use the literal relation names in the `allowedFields`. by @carvemerson in https://github.com/spatie/laravel-query-builder/pull/917
65+
* Add `unsetDefault` as a replacement for `default(null)` which was removed in 5.6.0 by @patrickrobrecht in https://github.com/spatie/laravel-query-builder/pull/902
66+
* Allow passing an array to the `defaultSort` function as documented by @MajidMohammadian in https://github.com/spatie/laravel-query-builder/pull/904
67+
* Add `disable_invalid_includes_query_exception` config option by @dimzeta in https://github.com/spatie/laravel-query-builder/pull/906
68+
* Update `AllowedFilter.php` to include `getFilterClass` function by @justasSendrauskas in https://github.com/spatie/laravel-query-builder/pull/909
69+
70+
### New Contributors
71+
72+
* @sergiy-petrov made their first contribution in https://github.com/spatie/laravel-query-builder/pull/899
73+
* @carvemerson made their first contribution in https://github.com/spatie/laravel-query-builder/pull/917
74+
* @patrickrobrecht made their first contribution in https://github.com/spatie/laravel-query-builder/pull/902
75+
* @MajidMohammadian made their first contribution in https://github.com/spatie/laravel-query-builder/pull/904
76+
* @dimzeta made their first contribution in https://github.com/spatie/laravel-query-builder/pull/906
77+
* @justasSendrauskas made their first contribution in https://github.com/spatie/laravel-query-builder/pull/909
78+
79+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.6.0...5.7.0
80+
81+
## 5.6.0 - 2023-10-05
82+
83+
### What's Changed
84+
85+
- Add support for defining includes by callback by @enricodelazzari in https://github.com/spatie/laravel-query-builder/pull/894
86+
- Add nullable filters by @enricodelazzari in https://github.com/spatie/laravel-query-builder/pull/895
87+
- Fix escaping control characters in partial filters by @GrahamCampbell in https://github.com/spatie/laravel-query-builder/pull/898
88+
89+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.5.0...5.6.0
90+
91+
## 5.5.0 - 2023-09-12
92+
93+
### What's Changed
94+
95+
- Add support for [`withExists`](https://laravel.com/docs/master/eloquent-relationships#other-aggregate-functions) via `IncludedExists` by @enricodelazzari in https://github.com/spatie/laravel-query-builder/pull/891
96+
- Use default values for all config keys (avoids issues when `QueryBuilder` is used as a dependency in a package)
97+
98+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.4.0...5.5.0
99+
100+
## 5.4.0 - 2023-09-08
101+
102+
### What's Changed
103+
104+
- Deprecate `request_data_source` config. The `QueryBuilder` will always look at both the query string and the request body when available now
105+
- Fix having `null` as the query parameter name for filters (see #889)
106+
- Bump actions/checkout from 3 to 4 by @dependabot in https://github.com/spatie/laravel-query-builder/pull/890
107+
108+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.3.0...5.4.0
109+
110+
## 5.3.0 - 2023-08-21
111+
112+
### What's Changed
113+
114+
- Accepts string value for the `fields` query parameter by @ezra-obiwale in https://github.com/spatie/laravel-query-builder/pull/872
115+
- Add `FiltersEndsWithStrict` filter by @utsavsomaiya in https://github.com/spatie/laravel-query-builder/pull/885
116+
- Make sure the `allowedSorts` are always set (even when none are requested) @luilliarcec in https://github.com/spatie/laravel-query-builder/pull/865
117+
118+
### New Contributors
119+
120+
- @ezra-obiwale made their first contribution in https://github.com/spatie/laravel-query-builder/pull/872
121+
- @utsavsomaiya made their first contribution in https://github.com/spatie/laravel-query-builder/pull/885
122+
123+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.2.0...5.3.0
124+
125+
## 5.2.0 - 2023-02-24
126+
127+
### What's Changed
128+
129+
- Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 by @dependabot in https://github.com/spatie/laravel-query-builder/pull/843
130+
- Update sorting.md by @shukriYusof in https://github.com/spatie/laravel-query-builder/pull/846
131+
- Update custom sorts link in documentation by @turpoint in https://github.com/spatie/laravel-query-builder/pull/844
132+
- Add config to disable InvalidSortQuery exception by @bohemima in https://github.com/spatie/laravel-query-builder/pull/830
133+
134+
### New Contributors
135+
136+
- @shukriYusof made their first contribution in https://github.com/spatie/laravel-query-builder/pull/846
137+
- @turpoint made their first contribution in https://github.com/spatie/laravel-query-builder/pull/844
138+
- @bohemima made their first contribution in https://github.com/spatie/laravel-query-builder/pull/830
139+
140+
**Full Changelog**: https://github.com/spatie/laravel-query-builder/compare/5.1.2...5.2.0
141+
5142
## 5.1.2 - 2023-01-24
6143

7144
### What's Changed

UPGRADING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Upgrading
22

3+
## From v5 to v6
4+
5+
A lot of the query builder classes now have typed properties and method parameters. If you have any custom sorts, includes, or filters, you will need to specify the property and parameter types used.
6+
7+
## Notice when upgrading to 5.6.0
8+
9+
The changes to the `default()` method break backwards compatibility when setting the default value to `null` (`default(null)`). This is pretty much an edge case, but if you're trying to unset the default value, you can use the `unsetDefault()` method instead.
10+
311
## From v4 to v5
412

513
This version adds support for Laravel 9 and drops support for all older version.

composer.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^8.0",
24-
"illuminate/database": "^9.0|^10.0",
25-
"illuminate/http": "^9.0|^10.0",
26-
"illuminate/support": "^9.0|^10.0",
23+
"php": "^8.2",
24+
"illuminate/database": "^10.0|^11.0",
25+
"illuminate/http": "^10.0|^11.0",
26+
"illuminate/support": "^10.0|^11.0",
2727
"spatie/laravel-package-tools": "^1.11",
2828
"doctrine/dbal": "^3.5"
2929
},
3030
"require-dev": {
3131
"ext-json": "*",
3232
"mockery/mockery": "^1.4",
33+
"nunomaduro/larastan": "^2.0",
3334
"orchestra/testbench": "^7.0|^8.0",
34-
"spatie/laravel-ray": "^1.28",
35-
"pestphp/pest": "^1.20"
35+
"phpunit/phpunit": "^10.0",
36+
"pestphp/pest": "^2.0",
37+
"spatie/invade": "^2.0"
3638
},
3739
"autoload": {
3840
"psr-4": {
@@ -47,7 +49,9 @@
4749
},
4850
"scripts": {
4951
"test": "vendor/bin/pest",
50-
"test-coverage": "phpunit --coverage-html coverage"
52+
"test-coverage": "phpunit --coverage-html coverage",
53+
"analyse": "vendor/bin/phpstan analyse --ansi --memory-limit=4G",
54+
"baseline": "vendor/bin/phpstan analyse --generate-baseline --memory-limit=4G"
5155
},
5256
"config": {
5357
"sort-packages": true,

config/query-builder.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,38 @@
2626
*/
2727
'count_suffix' => 'Count',
2828

29+
/*
30+
* Related model exists are included using the relationship name suffixed with this string.
31+
* For example: GET /users?include=postsExists
32+
*/
33+
'exists_suffix' => 'Exists',
34+
2935
/*
3036
* By default the package will throw an `InvalidFilterQuery` exception when a filter in the
3137
* URL is not allowed in the `allowedFilters()` method.
3238
*/
3339
'disable_invalid_filter_query_exception' => false,
3440

3541
/*
36-
* By default the package inspects query string of request using $request->query().
37-
* You can change this behavior to inspect the request body using $request->input()
38-
* by setting this value to `body`.
42+
* By default the package will throw an `InvalidSortQuery` exception when a sort in the
43+
* URL is not allowed in the `allowedSorts()` method.
44+
*/
45+
'disable_invalid_sort_query_exception' => false,
46+
47+
/*
48+
* By default the package will throw an `InvalidIncludeQuery` exception when an include in the
49+
* URL is not allowed in the `allowedIncludes()` method.
50+
*/
51+
'disable_invalid_includes_query_exception' => false,
52+
53+
/*
54+
* By default, the package expects relationship names to be snake case plural when using fields[relationship].
55+
* For example, fetching the id and name for a userOwner relation would look like this:
56+
* GET /users?fields[user_owner]=id,name
3957
*
40-
* Possible values: `query_string`, `body`
58+
* Set this to `false` if you don't want that and keep the requested relationship names as-is and allows you to
59+
* request the fields using a camelCase relationship name:
60+
* GET /users?fields[userOwner]=id,name
4161
*/
42-
'request_data_source' => 'query_string',
62+
'convert_relation_names_to_snake_case_plural' => true,
4363
];

0 commit comments

Comments
 (0)