Using this package, you can use spatial fields in Laravel Nova.
I am on an open-source journey 🚀, and I wish I could solely focus on my development path without worrying about my financial situation. However, as life is not perfect, I have to consider other factors.
Therefore, if you decide to use my packages, please kindly consider making a donation. Any amount, no matter how small, goes a long way and is greatly appreciated. 🍺
php artisan vendor:publish --provider="Mostafaznv\NovaMapField\NovaMapFieldServiceProvider"
bool
default: true
Specifies whether zoom in/out button should display on map or not
withoutZoomSlider
status
bool
default: true
Specifies whether zoom slider should display on map or not
withFullScreenControl
status
bool
default: true
Specifies whether full screen button should display on map or not
mapHeight
height
integer
default: 400
Map's height
hideDetailButton
status
bool
default: true
Specifies whether
Show Details
button should appear on detail pages or not
markerIcon
icon
integer
available: 1, 2, 3
Marker icon
withSearchBox
boolean
Specifies whether map has search box or not
searchProvider
provider
MapSearchProvider
searchProviderApiKey
apiKey
string
Specifies api key for search provider, if needed
withAutocompleteSearch
status
bool
default: true
Specifies whether search results should load immediately or not
searchAutocompleteMinLength
minLength
int
Specifies the minimum number of characters to trigger search action
searchAutocompleteTimeout
timeout
int
Specifies the minimum number of ms to wait before triggering search action
searchLanguage
language
string
Specifies preferable language
searchPlaceholder
placeholder
string
searchBoxType
type
MapSearchBoxType
Using this item, you can specify type of search box (button, or text-field
searchResultLimit
limit
int
Specifies limit of results
searchResultKeepOpen
status
boolean
Specifies whether the results keep opened
withTransformation
status
boolean
Specifies whether transport feature should be enable on polygons
transformScale
status
boolean
Using this method, you can enable/disable scaling features
transformRotate
status
boolean
Using this method, you can enable/disable rotating features
transformStretch
status
boolean
Using this method, you can enable/disable stretch option
requiredOnCreate
status
bool
default: true
Makes field required on creation
requiredOnUpdate
status
bool
default: true
Makes field required on update
default
$callback
PointValue
Set default value for map field.
Note: Only works in
MapPointField
capture
capture
Capture
experimental
By employing this method, you can capture a screenshot reflecting the current state of the map field and save it to the filesystem
Method
Default
Description
string
https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png
Default Template URL. Must include
{x}
,
{y}
or
{-y}
, and
{z}
placeholders.
projection
string
EPSG:3857
Default projection of map
Default SRID of map
default-latitude
Default latitude of map
default-longitude
Default longitude of map
Default zoom of map
controls.zoom-control
Specifies if map should display zoom controls (zoom in/out buttons) or not
controls.zoom-slider
Specifies if map should display zoom slider or not
controls.full-screen-control
false
Specifies if map should display full screen button or not
controls.undo-control
Specifies if map should display undo control or not (Only for
Polygon
and
MultiPolygon
)
controls.clear-map-control
Specifies if map should display clear map control or not (Only for
Polygon
and
MultiPolygon
)
map-height
Specifies map height
Specifies marker icon. available values:
1, 2, 3
style.stroke-color
string
Using this property, you can specify stroke color of polygons or other shapes. Either in hexadecimal or as RGBA array
style.stroke-width
Width of the stroke (px)
style.fill-color
string
rgba(255, 0, 0, 0.4)
Using this property, you can specify filling color of polygons or other shapes. Either in hexadecimal or as RGBA array.
show-detail-button
Specifies whether
Show Details
button should appear on detail pages or not
search.enable
Using this item, you can toggle displaying search box on maps
search.provider
MapSearchProvider
Specifies search provider available providers:
OSM, MAPQUEST, PHOTON, PELIAS, BING, OPENCAGE
search.api-key
string
Specifies API key if required
search.autocomplete
false
Using this item, you can toggle autocomplete feature for search box
search.autocomplete-min-length
The minimum number of characters to trigger search
search.autocomplete-timeout
The minimum number of ms to wait before triggering search action
search.language
string
en-US
Specifies preferable language
search.placeholder
string
Search for an address
Specifies placeholder for text input
search.box-type
MapSearchBoxType
TEXT_FIELD
Specifies type of search box. available types:
BUTTON, TEXT_FIELD
search.limit
Specifies limit of results
search.keep-open
false
Specifies whether the results keep opened
transform.enable
Using this item, you can toggle transforming polygons maps
transform.scale
Using this property, you can toggle scaling features
transform.scale
Using this property, you can toggle rotating features
transform.stretch
Using this property, you can enable/disable stretch option
Utilizing this method enables the capture of a screenshot that mirrors the current state of the map field, subsequently saving it to the filesystem. It is important to note that this feature is
experimental
and its performance may vary. The underlying mechanism operates by generating an image on the client's machine each time the client/admin modifies the map field state. Subsequently, this image is transmitted to the server, where it is then stored in the filesystem.
To enable this feature, you must first add the
capture
method to your map field. This method accepts a single argument, which is an instance of the
Capture
class.
Note
Activating this feature is as straightforward as calling the static
make
function of
Capture
. Nevertheless, for those seeking to tailor the behavior of this functionality, alternative methods are available for customization.
This package uses Laravel Eloquent Spatial under the hood. to use columns and querying them over the application, please read Laravel Eloquent Spatial documentation
To transform polygons, You should press
Alt
(Option
⌥
) button and drag that polygon everywhere you want.
To select polygons (and modify them), You can press
Alt
(Option
⌥
) button and then click on the polygon.
By pressing the
Alt
(Option
⌥
) key, drawing mode will be disabled, and you can select every polygon you want.
matanyadaev/laravel-eloquent-spatial
versions 2 and 3 has been dropped. The package now exclusively supports version 4 and higher.
HasSpatialColumns
trait has been removed from the package. Instead, use the
HasSpatial
trait from the laravel-eloquent-spatial package.
MapSearchBoxType
and
MapSearchProvider
custom enums have been refactored and are now located in the
Mostafaznv\NovaMapField\Enums
namespace, utilizing PHP 8.1 enums. This update affects:
searchBoxType
and
searchProvider
methods across all map field types (MapPointField, MapPolygonField, MapMultiPolygonField)
search.box-type
and
search.provider
.
I am on an open-source journey 🚀, and I wish I could solely focus on my development path without worrying about my financial situation. However, as life is not perfect, I have to consider other factors.
Therefore, if you decide to use my packages, please kindly consider making a donation. Any amount, no matter how small, goes a long way and is greatly appreciated. 🍺
This software is released under The MIT License (MIT) .