|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LaravelSpatial\Schema; |
|
4
|
|
|
|
|
5
|
|
|
class Blueprint extends \Illuminate\Database\Schema\Blueprint |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Add a geometry column on the table |
|
9
|
|
|
* |
|
10
|
|
|
* @param string $column |
|
11
|
|
|
* @return \Illuminate\Support\Fluent |
|
12
|
|
|
*/ |
|
13
|
27 |
|
public function geometry($column) |
|
14
|
|
|
{ |
|
15
|
27 |
|
return $this->addColumn('geometry', $column); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Add a point column on the table |
|
20
|
|
|
* |
|
21
|
|
|
* @param $column |
|
22
|
|
|
* @return \Illuminate\Support\Fluent |
|
23
|
|
|
*/ |
|
24
|
28 |
|
public function point($column, $srid = null) |
|
25
|
|
|
{ |
|
26
|
28 |
|
return $this->addColumn('point', $column, compact('srid')); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Add a linestring column on the table |
|
31
|
|
|
* |
|
32
|
|
|
* @param $column |
|
33
|
|
|
* @return \Illuminate\Support\Fluent |
|
34
|
|
|
*/ |
|
35
|
27 |
|
public function lineString($column) |
|
36
|
|
|
{ |
|
37
|
27 |
|
return $this->addColumn('linestring', $column); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Add a polygon column on the table |
|
42
|
|
|
* |
|
43
|
|
|
* @param $column |
|
44
|
|
|
* @return \Illuminate\Support\Fluent |
|
45
|
|
|
*/ |
|
46
|
27 |
|
public function polygon($column) |
|
47
|
|
|
{ |
|
48
|
27 |
|
return $this->addColumn('polygon', $column); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Add a multipoint column on the table |
|
53
|
|
|
* |
|
54
|
|
|
* @param $column |
|
55
|
|
|
* @return \Illuminate\Support\Fluent |
|
56
|
|
|
*/ |
|
57
|
27 |
|
public function multiPoint($column) |
|
58
|
|
|
{ |
|
59
|
27 |
|
return $this->addColumn('multipoint', $column); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Add a multilinestring column on the table |
|
64
|
|
|
* |
|
65
|
|
|
* @param $column |
|
66
|
|
|
* @return \Illuminate\Support\Fluent |
|
67
|
|
|
*/ |
|
68
|
27 |
|
public function multiLineString($column) |
|
69
|
|
|
{ |
|
70
|
27 |
|
return $this->addColumn('multilinestring', $column); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Add a multipolygon column on the table |
|
75
|
|
|
* |
|
76
|
|
|
* @param $column |
|
77
|
|
|
* @return \Illuminate\Support\Fluent |
|
78
|
|
|
*/ |
|
79
|
27 |
|
public function multiPolygon($column) |
|
80
|
|
|
{ |
|
81
|
27 |
|
return $this->addColumn('multipolygon', $column); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Add a geometrycollection column on the table |
|
86
|
|
|
* |
|
87
|
|
|
* @param $column |
|
88
|
|
|
* @return \Illuminate\Support\Fluent |
|
89
|
|
|
*/ |
|
90
|
27 |
|
public function geometryCollection($column) |
|
91
|
|
|
{ |
|
92
|
27 |
|
return $this->addColumn('geometrycollection', $column); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Specify a spatial index for the table |
|
97
|
|
|
* |
|
98
|
|
|
* @param string|array $columns |
|
99
|
|
|
* @param string $name |
|
100
|
|
|
* @return \Illuminate\Support\Fluent |
|
101
|
|
|
*/ |
|
102
|
25 |
|
public function spatialIndex($columns, $name = null) |
|
103
|
|
|
{ |
|
104
|
25 |
|
return $this->indexCommand('spatialIndex', $columns, $name); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Indicate that the given index should be dropped. |
|
109
|
|
|
* |
|
110
|
|
|
* @param string|array $index |
|
111
|
|
|
* @return \Illuminate\Support\Fluent |
|
112
|
|
|
*/ |
|
113
|
25 |
|
public function dropSpatialIndex($index) |
|
114
|
|
|
{ |
|
115
|
25 |
|
return $this->dropIndexCommand('dropIndex', 'spatialIndex', $index); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* Enable postgis on this database. |
|
120
|
|
|
* Will create the extension in the database. |
|
121
|
|
|
* |
|
122
|
|
|
* @return \Illuminate\Support\Fluent |
|
123
|
|
|
*/ |
|
124
|
2 |
|
public function enablePostgis() |
|
125
|
|
|
{ |
|
126
|
2 |
|
return $this->addCommand('enablePostgis'); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Disable postgis on this database. |
|
131
|
|
|
* WIll drop the extension in the database. |
|
132
|
|
|
* @return \Illuminate\Support\Fluent |
|
133
|
|
|
*/ |
|
134
|
2 |
|
public function disablePostgis() |
|
135
|
|
|
{ |
|
136
|
2 |
|
return $this->addCommand('disablePostgis'); |
|
137
|
|
|
} |
|
138
|
|
|
} |
|
139
|
|
|
|