Skip to content

Commit 519ee7b

Browse files
committed
Merge branch '2.1'
2 parents fa9c66e + 1aa5dbe commit 519ee7b

9 files changed

+25
-26
lines changed

.travis.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
language: php
22

3-
branches:
4-
only:
5-
- master
6-
- develop
7-
83
php:
94
- 7.1
105
- 7.2
6+
- 7.3
117

128
env:
139
- TESTBENCH_VERSION="3.6.*" # Laravel 5.6
1410
- TESTBENCH_VERSION="3.7.*" # Laravel 5.7
11+
- TESTBENCH_VERSION="3.8.*" # Laravel 5.8
1512

1613
install:
1714
- travis_retry composer self-update

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ An on-the-fly GraphQL Schema generator from Eloquent models for Laravel.
1515

1616
## Version Compatibility
1717

18-
| Laravel | Bakery | Support |
19-
| :------ | :----- | :------ |
20-
| 5.4.x | 1.0.x | |
21-
| 5.5.x | 1.0.x | |
22-
| 5.6.x | 2.0.x ||
23-
| 5.7.x | 2.1.x ||
18+
| Laravel | Bakery | Support |
19+
| :------------------ | :----- | :------ |
20+
| 5.4.x, 5.5.x | 1.0.x | |
21+
| 5.6.x, 5.7.x, 5.8.x | 2.1.x ||
2422

2523
## Installation
2624

@@ -35,7 +33,7 @@ or require in `composer.json`:
3533
```json
3634
{
3735
"require": {
38-
"scrnhq/laravel-bakery": "^2.1"
36+
"scrnhq/laravel-bakery": "^2.2"
3937
}
4038
}
4139
```

composer.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"require": {
2020
"php": ">=7.1.0",
21-
"illuminate/support": "5.6.*|5.7.*",
21+
"illuminate/support": "5.6.*|5.7.*|5.8.*",
2222
"webonyx/graphql-php": "^0.12.0",
2323
"ext-json": "*"
2424
},
@@ -27,6 +27,8 @@
2727
"phpunit/phpunit": "^7.1",
2828
"mockery/mockery": "^1.2"
2929
},
30+
"minimum-stability": "dev",
31+
"prefer-stable": true,
3032
"autoload": {
3133
"psr-4": {
3234
"Bakery\\": "src"

src/Traits/JoinsRelationships.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public function joinRelation(Builder $query, Relations\Relation $relation, strin
1919
$related = $relation->getRelated();
2020

2121
if ($relation instanceof Relations\BelongsTo) {
22-
$query->join($related->getTable(), $relation->getQualifiedOwnerKeyName(), '=', $relation->getQualifiedForeignKey(), $type, $where);
22+
$foreignKeyName = method_exists($relation, 'getQualifiedForeignKey')
23+
? $relation->getQualifiedForeignKey() : $relation->getQualifiedForeignKeyName();
24+
$query->join($related->getTable(), $relation->getQualifiedOwnerKeyName(), '=', $foreignKeyName, $type, $where);
2325
} elseif ($relation instanceof Relations\BelongsToMany) {
2426
$foreignPivotKeyName = method_exists($relation, 'getQualifiedForeignPivotKeyName')
2527
? $relation->getQualifiedForeignPivotKeyName() : $relation->getQualifiedForeignKeyName();

tests/Feature/CollectionQueryTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,14 @@ public function it_can_order_by_combination_of_nested_relations()
373373
/** @test */
374374
public function it_can_order_by_relations_and_have_correct_pagination_count()
375375
{
376-
$john = factory(User::class)->create(['email' => '[email protected]']);
377-
$jane = factory(User::class)->create(['email' => '[email protected]']);
378-
$joe = factory(User::class)->create(['email' => '[email protected]']);
376+
$john = factory(Models\User::class)->create(['email' => '[email protected]']);
377+
$jane = factory(Models\User::class)->create(['email' => '[email protected]']);
378+
$joe = factory(Models\User::class)->create(['email' => '[email protected]']);
379379

380-
factory(Article::class)->create(['title' => 'Hello alpha', 'user_id' => $john->id]);
381-
factory(Article::class)->create(['title' => 'Hello beta', 'user_id' => $john->id]);
382-
factory(Article::class)->create(['title' => 'Hello gamma', 'user_id' => $jane->id]);
383-
factory(Article::class)->create(['title' => 'Hello zeta', 'user_id' => $joe->id]);
380+
factory(Models\Article::class)->create(['title' => 'Hello alpha', 'user_id' => $john->id]);
381+
factory(Models\Article::class)->create(['title' => 'Hello beta', 'user_id' => $john->id]);
382+
factory(Models\Article::class)->create(['title' => 'Hello gamma', 'user_id' => $jane->id]);
383+
factory(Models\Article::class)->create(['title' => 'Hello zeta', 'user_id' => $joe->id]);
384384

385385
$query = '
386386
query {
@@ -400,7 +400,7 @@ public function it_can_order_by_relations_and_have_correct_pagination_count()
400400
}
401401
';
402402

403-
$response = $this->graphql($query);
403+
$response = $this->json('GET', '/graphql', ['query' => $query]);
404404
$result = json_decode($response->getContent())->data->users;
405405
$this->assertEquals(3, $result->pagination->total);
406406
}

tests/IntegrationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ abstract class IntegrationTest extends TestCase
3535
*
3636
* @return void
3737
*/
38-
protected function setUp()
38+
protected function setUp(): void
3939
{
4040
parent::setUp();
4141

tests/Traits/BakeryTransactionalAwareTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BakeryTransactionalAwareTest extends IntegrationTest
2222
/**
2323
* Set up the tests.
2424
*/
25-
public function setUp()
25+
public function setUp(): void
2626
{
2727
parent::setUp();
2828

tests/TypeRegistryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TypeRegistryTest extends IntegrationTest
2323
/**
2424
* Set up the tests.
2525
*/
26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Types/FieldTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FieldTest extends IntegrationTest
2323
/**
2424
* Set up the tests.
2525
*/
26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

0 commit comments

Comments
 (0)