From e27107864b869a2f60b4bb5a1a1f6126ab9b93a7 Mon Sep 17 00:00:00 2001 From: frkcn Date: Tue, 8 Feb 2022 22:08:48 +0300 Subject: [PATCH 1/3] Laravel 9 support added. --- .github/workflows/main.yml | 7 ++----- CHANGELOG.md | 12 +++++++++++- composer.json | 6 +++--- tests/HasSpatialTest.php | 10 +++++----- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f1fb2ac..339992a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,12 +8,9 @@ jobs: strategy: fail-fast: true matrix: - php: [8.0] - laravel: [8.*] + php: [8.0, 8.1] + laravel: [8, 9] dependency-version: [prefer-lowest, prefer-stable] - include: - - laravel: 8.* - testbench: 6.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e54fc9e..e98fd32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to `laravel-spatial` will be documented in this file -## 1.0.0 - 201X-XX-XX +## 1.2.0 - 2012-02-08 +- Laravel 9 support added. +## 1.1.1 - 2012-01-20 +- axis-order added to setter of LocationCast. +- axis-order added to query in HasSpatial trait. + +## 1.1.0 - 2012-01-20 +- Point type added to Doctrine mapped types in the service provider. +- SRID support added to setter of LocationCast. + +## 1.0.0 - 2012-01-18 - initial release diff --git a/composer.json b/composer.json index e06f655..8969287 100644 --- a/composer.json +++ b/composer.json @@ -16,12 +16,12 @@ } ], "require": { - "php": "^8.0", - "illuminate/support": "^8.0" + "php": "^8.0|^8.1", + "illuminate/support": "^8.0|^9.0" }, "require-dev": { "doctrine/dbal": "^3.3", - "orchestra/testbench": "^6.0", + "orchestra/testbench": "^6.0|^7.0", "phpunit/phpunit": "^9.0" }, "autoload": { diff --git a/tests/HasSpatialTest.php b/tests/HasSpatialTest.php index 8b5d6ea..3f3dc2e 100644 --- a/tests/HasSpatialTest.php +++ b/tests/HasSpatialTest.php @@ -22,7 +22,7 @@ public function it_generates_sql_query_for_selectDistanceTo_scope(): void // Assert $this->assertEquals( - expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr, ST_Distance( + expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr, ST_Distance( ST_SRID($castedAttr, ?), ST_SRID(Point(?, ?), ?) ) as distance from `addresses`", @@ -45,7 +45,7 @@ public function it_generates_sql_query_for_withinDistanceTo_scope(): void // 3. Assert $this->assertEquals( - expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` where ST_Distance( + expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` where ST_Distance( ST_SRID($castedAttr, ?), ST_SRID(Point(?, ?), ?) ) <= ?", @@ -69,7 +69,7 @@ public function it_generates_sql_query_for_orderByDistanceTo_scope(): void // 3. Assert $this->assertEquals( - expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance( + expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance( ST_SRID($castedAttr, ?), ST_SRID(Point(?, ?), ?) ) asc", @@ -77,7 +77,7 @@ public function it_generates_sql_query_for_orderByDistanceTo_scope(): void ); $this->assertEquals( - expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance( + expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance( ST_SRID($castedAttr, ?), ST_SRID(Point(?, ?), ?) ) desc", @@ -97,7 +97,7 @@ public function it_generates_sql_query_for_location_casted_attributes(): void // 2. Act & Assert $this->assertEquals( - expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses`", + expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses`", actual: $address->query()->toSql() ); } From 13d3bf8933c92b98afa535d4e4ab9f8022b39217 Mon Sep 17 00:00:00 2001 From: frkcn Date: Tue, 8 Feb 2022 22:54:53 +0300 Subject: [PATCH 2/3] workflows updated --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 339992a..169a577 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,6 +11,11 @@ jobs: php: [8.0, 8.1] laravel: [8, 9] dependency-version: [prefer-lowest, prefer-stable] + include: + - laravel: 9.* + testbench: 7.* + - laravel: 8.* + testbench: 6.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} From e60d679f2cd61799c2cf23ea2e4390e28032e475 Mon Sep 17 00:00:00 2001 From: frkcn Date: Tue, 8 Feb 2022 23:05:56 +0300 Subject: [PATCH 3/3] workflows updated --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 169a577..693da5b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,8 +9,8 @@ jobs: fail-fast: true matrix: php: [8.0, 8.1] - laravel: [8, 9] - dependency-version: [prefer-lowest, prefer-stable] + laravel: [8.*, 9.*] + stability: [prefer-lowest, prefer-stable] include: - laravel: 9.* testbench: 7.*