Skip to content

Commit 2612985

Browse files
committed
Merge branch 'master' into fork/alancolant/resolve-query-instance
2 parents 1ae71aa + 9c40724 commit 2612985

22 files changed

+1082
-371
lines changed

.github/workflows/analysis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Code Analysis
33
on:
44
pull_request:
55
push:
6+
branches:
7+
- master
68
schedule:
79
# Run Monday morning at 3 o'clock
810
# ┌───────────── minute (0 - 59)
@@ -28,7 +30,7 @@ jobs:
2830
COMPOSER_NO_INTERACTION: 1
2931

3032
steps:
31-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@v5
3234

3335
- uses: shivammathur/setup-php@v2
3436
with:
@@ -58,11 +60,11 @@ jobs:
5860
runs-on: ubuntu-latest
5961

6062
steps:
61-
- uses: actions/checkout@v4
63+
- uses: actions/checkout@v5
6264

6365
- uses: shivammathur/setup-php@v2
6466
with:
65-
php-version: 8.3
67+
php-version: 8.4
6668
coverage: none
6769

6870
- name: Get composer cache directory

.github/workflows/integration_tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Integration tests
33
on:
44
pull_request:
55
push:
6+
branches:
7+
- master
68
schedule:
79
# Run Monday morning at 3 o'clock
810
# ┌───────────── minute (0 - 59)
@@ -25,15 +27,15 @@ jobs:
2527
strategy:
2628
fail-fast: false
2729
matrix:
28-
php: [8.2, 8.3, 8.4]
30+
php: [8.2, 8.3, 8.4, 8.5]
2931
laravel: [^11.0, ^12.0]
3032
name: P=${{ matrix.php }} L=${{ matrix.laravel }}
3133
runs-on: ubuntu-latest
3234
env:
3335
COMPOSER_NO_INTERACTION: 1
3436

3537
steps:
36-
- uses: actions/checkout@v4
38+
- uses: actions/checkout@v5
3739

3840
- uses: shivammathur/setup-php@v2
3941
with:

.github/workflows/tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Tests
33
on:
44
pull_request:
55
push:
6+
branches:
7+
- master
68
schedule:
79
# Run Monday morning at 3 o'clock
810
# ┌───────────── minute (0 - 59)
@@ -25,7 +27,7 @@ jobs:
2527
strategy:
2628
fail-fast: false
2729
matrix:
28-
php: [8.2, 8.3, 8.4]
30+
php: [8.2, 8.3, 8.4, 8.5]
2931
laravel: [^11.0, ^12.0]
3032
stability: [prefer-lowest, prefer-stable]
3133
name: P=${{ matrix.php }} L=${{ matrix.laravel }} ${{ matrix.stability }}
@@ -34,7 +36,7 @@ jobs:
3436
COMPOSER_NO_INTERACTION: 1
3537

3638
steps:
37-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v5
3840

3941
- uses: shivammathur/setup-php@v2
4042
with:

.php-cs-fixer.dist.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
return (new Config())
1010
->setFinder($finder)
1111
->setRules(\Mfn\PhpCsFixer\Config::getRules())
12-
->setRiskyAllowed(true);
12+
->setRiskyAllowed(true)
13+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
CHANGELOG
22
=========
33

4-
[Next release](https://github.com/rebing/graphql-laravel/compare/9.9.0...master)
4+
[Next release](https://github.com/rebing/graphql-laravel/compare/9.12.0...master)
5+
6+
2025-11-05, 9.12.0
7+
------------------
8+
9+
### Fixed
10+
- Fixed type declaration mismatch in scalar type classes generated by `make:graphql:scalar` command by removing premature type hints from the stub [\#1190 / iisyos](https://github.com/rebing/graphql-laravel/pull/1190)
11+
12+
2025-10-07, 9.11.0
13+
------------------
14+
15+
## Added
16+
- Add `route_attributes` support for GraphQL routes [\#1186 / alissn](https://github.com/rebing/graphql-laravel/pull/1186)
17+
18+
2025-05-17, 9.10.0
19+
------------------
20+
21+
## Added
22+
- Support Laravels cursor pagination [\#1180 / Davidnadejdin](https://github.com/rebing/graphql-laravel/pull/1180)
523

624
2025-02-24, 9.9.0
725
-----------------

README.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ config/graphql.php
6363
- [GraphQL resolver middleware](#graphql-resolver-middleware)
6464
- [Schemas](#schemas)
6565
- [Schema classes](#schema-classes)
66+
- [Route attributes](#route-attributes)
6667
- [Creating a query](#creating-a-query)
6768
- [Creating a mutation](#creating-a-mutation)
6869
- [File uploads](#file-uploads)
@@ -245,7 +246,7 @@ schemas and assign different **HTTP middleware** and **execution middleware** to
245246
them, in addition to the global middleware. For example:
246247

247248
```php
248-
'schema' => 'default',
249+
'default_schema' => 'default',
249250

250251
'schemas' => [
251252
'default' => [
@@ -275,6 +276,11 @@ them, in addition to the global middleware. For example:
275276
'execution_middleware' => [
276277
\Rebing\GraphQL\Support\ExecutionMiddleware\UnusedVariablesMiddleware::class,
277278
],
279+
// Route attributes applied to the generated HTTP route for this schema
280+
// Example: expose this schema on a dedicated subdomain
281+
'route_attributes' => [
282+
'domain' => 'api.example.com',
283+
],
278284
],
279285
],
280286
```
@@ -284,6 +290,24 @@ which it is accessible. Per the default configuration of `prefix = graphql`, the
284290
_default_ schema is accessible via `/graphql`.
285291

286292

293+
#### Route attributes
294+
295+
You can customize the HTTP route generated for a specific schema using the `route_attributes` key.
296+
This is useful for setting parameters supported by Laravel routes, e.g. a custom `domain`.
297+
298+
```php
299+
'schemas' => [
300+
'with_custom_domain' => [
301+
'query' => [
302+
App\GraphQL\Queries\UsersQuery::class,
303+
],
304+
'middleware' => ['auth:api'],
305+
'route_attributes' => [
306+
'domain' => 'api.example.com',
307+
],
308+
],
309+
]
310+
```
287311

288312

289313
#### Schema classes
@@ -1895,6 +1919,37 @@ class PostsQuery extends Query
18951919
}
18961920
```
18971921

1922+
[Cursor Pagination](https://laravel.com/docs/pagination#cursor-pagination) will be used, if a query or mutation returns a `CursorPaginationType`.
1923+
1924+
```php
1925+
namespace App\GraphQL\Queries;
1926+
1927+
use Closure;
1928+
use GraphQL\Type\Definition\ResolveInfo;
1929+
use GraphQL\Type\Definition\Type;
1930+
use Rebing\GraphQL\Support\Facades\GraphQL;
1931+
use Rebing\GraphQL\Support\Query;
1932+
1933+
class PostsQuery extends Query
1934+
{
1935+
public function type(): Type
1936+
{
1937+
return GraphQL::cursorPaginate('posts');
1938+
}
1939+
1940+
// ...
1941+
1942+
public function resolve($root, array $args, $context, ResolveInfo $info, Closure $getSelectFields)
1943+
{
1944+
$fields = $getSelectFields();
1945+
1946+
return Post::with($fields->getRelations())
1947+
->select($fields->getSelect())
1948+
->cursorPaginate($args['limit'], ['*'], 'cursorName', $args['cursor']);
1949+
}
1950+
}
1951+
```
1952+
18981953
### Batching
18991954

19001955
Batched requests are required to be sent via a POST request.
@@ -2005,7 +2060,7 @@ class EpisodeEnum extends EnumType
20052060
> will be able to choose from, while the value is what will your server receive (what will enum
20062061
> be resolved to).
20072062
2008-
The Enum will be registered like any other type in your schema in `config/graphq.php`:
2063+
The Enum will be registered like any other type in your schema in `config/graphql.php`:
20092064

20102065
```php
20112066
'schemas' => [
@@ -2266,7 +2321,7 @@ class ReviewInput extends InputType
22662321
}
22672322
```
22682323

2269-
The Input Object will be registered like any other type in your schema in `config/graphq.php`:
2324+
The Input Object will be registered like any other type in your schema in `config/graphql.php`:
22702325

22712326
```php
22722327
'schemas' => [

config/config.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393

9494
// An array of middlewares, overrides the global ones
9595
'execution_middleware' => null,
96+
97+
// Route attributes applied when generating the HTTP route for this schema
98+
// Example:
99+
// 'route_attributes' => [
100+
// 'domain' => 'api.example.com',
101+
// ]
102+
'route_attributes' => [],
96103
],
97104
],
98105

@@ -152,6 +159,12 @@
152159
*/
153160
'simple_pagination_type' => Rebing\GraphQL\Support\SimplePaginationType::class,
154161

162+
/*
163+
* You can define your own cursor pagination type.
164+
* Reference Rebing\GraphQL\Support\CursorPaginationType::class
165+
*/
166+
'cursor_pagination_type' => Rebing\GraphQL\Support\CursorPaginationType::class,
167+
155168
/*
156169
* Overrides the default field resolver
157170
* See http://webonyx.github.io/graphql-php/data-fetching/#default-field-resolver

0 commit comments

Comments
 (0)