Skip to content

Commit 3e2a842

Browse files
committed
Update changelog and README for Laravel 12 and PHP 8.4 support; remove support for older versions
1 parent 03bf385 commit 3e2a842

File tree

2 files changed

+8
-61
lines changed

2 files changed

+8
-61
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

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

5+
## 3.0.0 - 2025-02-20
6+
- Laravel 12 and PHP 8.4 support added.
7+
- Laravel 10 and below versions are not supported anymore.
8+
- PHP 8.1 and below versions are not supported anymore.
9+
510
## 2.0.1 - 2024-11-27
611
- Fix the incorrect parameter count error while using `ST_SRID` functions with `MariaDB`.
712

README.md

+3-61
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`
@@ -41,43 +41,6 @@ php artisan make:model Address --migration
4141

4242
### 1- Migrations:
4343

44-
## Code Differences Based on Laravel Version
45-
46-
Some code snippets in the project differ before and after Laravel 11 version. Below are the steps to specify these differences:
47-
48-
### For Laravel 8, 9, and 10 Versions
49-
50-
To add a spatial data field, you need to extend the migration from `TarfinLabs\LaravelSpatial\Migrations\SpatialMigration`.
51-
52-
It is a simple abstract class that adds `point` spatial data type to Doctrine mapped types in the constructor.
53-
```php
54-
use TarfinLabs\LaravelSpatial\Migrations\SpatialMigration;
55-
use Illuminate\Database\Schema\Blueprint;
56-
use Illuminate\Support\Facades\Schema;
57-
58-
return new class extends SpatialMigration {
59-
60-
public function up(): void
61-
{
62-
Schema::create('addresses', function (Blueprint $table) {
63-
$table->point('location');
64-
})
65-
}
66-
}
67-
```
68-
69-
The migration above creates an `addresses` table with a `location` spatial column.
70-
71-
> Spatial columns with no SRID attribute are not SRID-restricted and accept values with any SRID. However, the optimizer cannot use SPATIAL indexes on them until the column definition is modified to include an SRID attribute, which may require that the column contents first be modified so that all values have the same SRID.
72-
73-
So you should give an SRID attribute to use spatial indexes in the migrations and indexed columns must be NOT NULL:
74-
75-
```php
76-
Schema::create('addresses', function (Blueprint $table) {
77-
$table->point(column: 'location', srid: 4326);
78-
79-
$table->spatialIndex('location');
80-
})
8144
```
8245
### For Laravel 11 and Above Versions
8346
@@ -93,7 +56,7 @@ return new class extends Migration {
9356
public function up(): void
9457
{
9558
Schema::create('addresses', function (Blueprint $table) {
96-
$table->geography('location', 'point');
59+
$table->geography('location', subtype: 'point');
9760
})
9861
}
9962
@@ -106,27 +69,6 @@ When adding a new location column with an index in Laravel, it can be troublesom
10669

10770
To solve this problem, it is recommended to perform a two-step migration like following:
10871

109-
### For Laravel 8, 9, and 10 Versions
110-
```php
111-
public function up()
112-
{
113-
// Add the new location column as nullable
114-
Schema::table('table', function (Blueprint $table) {
115-
$table->point('location')->nullable();
116-
});
117-
118-
// In the second go, set 0,0 values, make the column not null and finally add the spatial index
119-
Schema::table('table', function (Blueprint $table) {
120-
DB::statement("UPDATE `table` SET `location` = POINT(0,0);");
121-
122-
DB::statement("ALTER TABLE `table` CHANGE `location` `location` POINT NOT NULL;");
123-
124-
$table->spatialIndex('location');
125-
});
126-
}
127-
```
128-
129-
13072
### For Laravel 11 and Above Versions
13173

13274
```php

0 commit comments

Comments
 (0)