You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+2-45
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ It supports only MySQL Spatial Data Types and Functions, other RDBMS is on the r
12
12
13
13
| Version | Supported Laravel Versions |
14
14
|---------|----------------------------|
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`|
17
17
18
18
**Supported data types:**
19
19
-`Point`
@@ -79,27 +79,6 @@ Schema::create('addresses', function (Blueprint $table) {
79
79
$table->spatialIndex('location');
80
80
})
81
81
```
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.
103
82
104
83
#### Issue with adding a new location column with index to an existing table:
105
84
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()
126
105
}
127
106
```
128
107
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) {
0 commit comments