Skip to content

Commit 582744d

Browse files
authored
Merge pull request #36 from tarfin-labs/laravel-11
[2.X] Update CI workflow, remove Laravel 11 support, and adjust README and changelog
2 parents b8abe0b + bdc9dc3 commit 582744d

File tree

4 files changed

+23
-64
lines changed

4 files changed

+23
-64
lines changed

.github/workflows/main.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
11
name: run-tests
22

3-
on: [push, pull_request]
3+
on:
4+
- push
5+
- pull_request
46

57
jobs:
68
test:
79
runs-on: ubuntu-latest
8-
strategy:
9-
fail-fast: true
10-
matrix:
11-
php: ['8.0', 8.1, 8.2, 8.3]
12-
laravel: [8, 9, 10, 11]
13-
exclude:
14-
- php: '8.0'
15-
laravel: 10
16-
- php: '8.0'
17-
laravel: 11
18-
- php: '8.2'
19-
laravel: 8
20-
- php: '8.1'
21-
laravel: 11
22-
23-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2410

2511
services:
2612
mysql:
@@ -32,9 +18,21 @@ jobs:
3218
- 3306
3319
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
3420

21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
php: ['8.0', 8.1, 8.2, 8.3]
25+
laravel: [8, 9, 10]
26+
stability: [prefer-lowest, prefer-stable]
27+
exclude:
28+
- php: '8.0'
29+
laravel: 10
30+
31+
name: P${{ matrix.php }} - L${{ matrix.laravel }}
32+
3533
steps:
3634
- name: Checkout code
37-
uses: actions/checkout@v2
35+
uses: actions/checkout@v4
3836

3937
- name: Setup PHP
4038
uses: shivammathur/setup-php@v2

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/.idea
33
/.phpunit.result.cache
44
/composer.lock
5-
/.phpunit.cache
5+
/.phpunit.cache
6+
.DS_Store

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All notable changes to `laravel-spatial` will be documented in this file
44

5+
## 2.1.0 - 2025-02-20
6+
- Removed support for Laravel 11 due to incompatibility with the current implementation.
7+
58
## 2.0.1 - 2024-11-27
69
- Fix the incorrect parameter count error while using `ST_SRID` functions with `MariaDB`.
710

README.md

+2-45
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ It supports only MySQL Spatial Data Types and Functions, other RDBMS is on the r
1212

1313
| Version | Supported Laravel Versions |
1414
|---------|----------------------------|
15-
| `2.x` | `^11.0` |
16-
| `1.x` | `^8.0, ^9.0, ^10.0` |
15+
| `3.x` | `^11.0`, `^12.0` |
16+
| `2.x` | `^8.0, ^9.0, ^10.0` |
1717

1818
**Supported data types:**
1919
- `Point`
@@ -79,27 +79,6 @@ Schema::create('addresses', function (Blueprint $table) {
7979
$table->spatialIndex('location');
8080
})
8181
```
82-
### For Laravel 11 and Above Versions
83-
84-
From Laravel 11 onwards, migrations are created as follows:
85-
86-
```php
87-
use Illuminate\Database\Migrations\Migration;
88-
use Illuminate\Database\Schema\Blueprint;
89-
use Illuminate\Support\Facades\Schema;
90-
91-
return new class extends Migration {
92-
93-
public function up(): void
94-
{
95-
Schema::create('addresses', function (Blueprint $table) {
96-
$table->geography('location', 'point');
97-
})
98-
}
99-
100-
}
101-
```
102-
In Laravel 11, the methods **point**, **lineString**, **polygon**, **geometryCollection**, **multiPoint**, **multiLineString**, and **multiPolygon** have been removed. Therefore, we are updating to use the **geography** method instead. The `geography` method sets the default SRID value to 4326.
10382

10483
#### Issue with adding a new location column with index to an existing table:
10584
When adding a new location column with an index in Laravel, it can be troublesome if you have existing data. One common mistake is trying to set a default value for the new column using `->default(new Point(0, 0, 4326))`. However, `POINT` columns cannot have a default value, which can cause issues when trying to add an index to the column, as indexed columns cannot be nullable.
@@ -126,28 +105,6 @@ public function up()
126105
}
127106
```
128107

129-
130-
### For Laravel 11 and Above Versions
131-
132-
```php
133-
public function up()
134-
{
135-
// Add the new location column as nullable
136-
Schema::table('table', function (Blueprint $table) {
137-
$table->geography('location', 'point')->nullable();
138-
});
139-
140-
// In the second go, set 0,0 values, make the column not null and finally add the spatial index
141-
Schema::table('table', function (Blueprint $table) {
142-
DB::statement("UPDATE `addresses` SET `location` = ST_GeomFromText('POINT(0 0)', 4326);");
143-
144-
DB::statement("ALTER TABLE `table` CHANGE `location` `location` POINT NOT NULL;");
145-
146-
$table->spatialIndex('location');
147-
});
148-
}
149-
```
150-
151108
***
152109

153110
### 2- Models:

0 commit comments

Comments
 (0)