Skip to content

Commit 1aa5dbe

Browse files
committed
✨ Laravel 5.8 support (#98)
* Add Laravel 5.8 support * Set minimum stability to dev * Add void return type to setUp for PHPUnit 8+ compatibility * Change getQualifiedForeignKey method call * Remove redundant testing trait * Update README
1 parent 68b4831 commit 1aa5dbe

File tree

9 files changed

+18
-156
lines changed

9 files changed

+18
-156
lines changed

.travis.yml

Lines changed: 2 additions & 5 deletions
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

Lines changed: 5 additions & 7 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
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
},
2525
"require-dev": {
2626
"orchestra/testbench": "~3.0",
2727
"phpunit/phpunit": "^7.1"
2828
},
29+
"minimum-stability": "dev",
30+
"prefer-stable": true,
2931
"autoload": {
3032
"psr-4": {
3133
"Bakery\\": "src"

src/Traits/JoinsRelationships.php

Lines changed: 3 additions & 1 deletion
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/IntegrationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Contracts\Auth\Access\Gate;
1010
use Bakery\Tests\Fixtures\IntegrationTestSchema;
1111
use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase;
12+
use Illuminate\Foundation\Testing\Concerns\InteractsWithExceptionHandling;
1213

1314
abstract class IntegrationTest extends TestCase
1415
{
@@ -25,7 +26,7 @@ abstract class IntegrationTest extends TestCase
2526
*
2627
* @return void
2728
*/
28-
protected function setUp()
29+
protected function setUp(): void
2930
{
3031
parent::setUp();
3132

tests/InteractsWithExceptionHandling.php

Lines changed: 0 additions & 138 deletions
This file was deleted.

tests/Traits/BakeryTransactionalAwareTest.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)