8000 [Feature] Update Laravel 8 support and drop Laravel 7 · ben221199/laravel-json-api@4aebdf6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4aebdf6

Browse files
committed
[Feature] Update Laravel 8 support and drop Laravel 7
Minimum PHP version is now 7.3.
1 parent 721d7eb commit 4aebdf6

File tree

6 files changed

+21
-16
lines changed
Expand file tree

6 files changed

+21
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ in the response body can be tested using:
1212
`$this->jsonApi()->asMultiPartFormData()->withPayload($data)->post('/api/v1/avatars');`.
1313

1414
### Changed
15+
- Minimum PHP version is now `7.3`.
16+
- Minimum Laravel version is now `8.0`.
1517
- [#497](https://github.com/cloudcreativity/laravel-json-api/issues/497) and
1618
[#529](https://github.com/cloudcreativity/laravel-json-api/pull/529)
1719
**BREAKING:** The method signature of the `AbstractValidators::rules()` method has changed,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ A demo application is available at [here](https://github.com/cloudcreativity/dem
6363
| Laravel | This Package |
6464
| --- | --- |
6565
| `^8.0` | `^3.0` |
66-
| `^7.0` | `^2.0`, `^3.0` |
66+
| `^7.0` | `^2.0` |
6767
| `^6.0` | `^1.7` |
6868
| `5.8.*` | `^1.7` |
6969
| `5.7.*` | `^1.0` |

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
}
2323
],
2424
"require": {
25-
"php": "^7.2",
25+
"php": "^7.3",
2626
"ext-json": "*",
27-
"illuminate/console": "^7.0|^8.0",
28-
"illuminate/contracts": "^7.0|^8.0",
29-
"illuminate/database": "^7.0|^8.0",
30-
"illuminate/filesystem": "^7.0|^8.0",
31-
"illuminate/http": "^7.0|^8.0",
32-
"illuminate/pagination": "^7.0|^8.0",
33-
"illuminate/support": "^7.0|^8.0",
27+
"illuminate/console": "^8.0",
28+
"illuminate/contracts": "^8.0",
29+
"illuminate/database": "^8.0",
30+
"illuminate/filesystem": "^8.0",
31+
"illuminate/http": "^8.0",
32+
"illuminate/pagination": "^8.0",
33+
"illuminate/support": "^8.0",
3434
"neomerx/json-api": "^1.0.3",
3535
"nyholm/psr7": "^1.2",
3636
"ramsey/uuid": "^3.0|^4.0",
@@ -39,11 +39,11 @@
3939
"require-dev": {
4040
"ext-sqlite3": "*",
4141
"cloudcreativity/json-api-testing": "^3.1",
42-
"guzzlehttp/guzzle": "^6.3|^7.0",
42+
"guzzlehttp/guzzle": "^7.0",
4343
"laravel/legacy-factories": "^1.0.4",
4444
"laravel/ui": "^2.0",
4545
"mockery/mockery": "^1.1",
46-
"orchestra/testbench": "^5.0|^6.0",
46+
"orchestra/testbench": "^6.0",
4747
"phpunit/phpunit": "^9.0"
4848
},
4949
"suggest": {
@@ -78,7 +78,7 @@
7878
}
7979
}
8080
},
81-
"minimum-stability": "dev",
81+
"minimum-stability": "stable",
8282
"prefer-stable": true,
8383
"config": {
8484
"sort-packages": true

docs/upgrade.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ protected function rules($record, array $data): array
2626
}
2727
```
2828

29+
> Note that `$record` will still be `null` if the request will create a new resource.
30+
2931
### Soft Deletes
3032

3133
Previously if no soft deletes field was set on an adapter, the JSON API field would default to the dash-case

src/Document/Error/Translator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,13 @@ public function call(\Closure $closure, ...$args): ErrorInterface
529529
*/
530530
protected function trans(string $key, string $member, array $replace = [], ?string $locale = null)
531531
{
532-
return $this->translator->get(
533-
"jsonapi::errors.{$key}.{$member}",
532+
$value = $this->translator->get(
533+
$key = "jsonapi::errors.{$key}.{$member}",
534534
$replace,
535535
$locale
536536
) ?: null;
537+
538+
return ($key !== $value) ? $value : null;
537539
}
538540

539541
/**

tests/lib/Integration/Validation/QueryValidationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ public function testSearchWithFailureMeta(): void
146146

147147
$this->resourceType = 'posts';
148148
$this->doSearch(['filter' => ['foo' => 'bar']])
149-
->assertStatus(400)
150-
->assertExactJson(['errors' => [$expected]]);
149+
->assertExactErrorStatus($expected);
151150
}
152151

153152
/**

0 commit comments

Comments
 (0)
0