enmaboya/place-input

A Laravel Nova field.

1.0 2021-09-07 12:31 UTC

This package is auto-updated.

Last update: 2024-04-07 19:52:16 UTC


README

This package provides a customisable field with a city/country/place of interest search.

Powered by Nominatim.

Installation

composer require enmaboya/place-input

Basic usage

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')

Available settings

  1. onlyCities - city search only

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->onlyCities()
  1. onlyCountries - country search only

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->onlyCountries()
  1. onlyStates - search only by state \ area

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->onlyStates()
  1. onlyCounties - search by county only (e.g. Colombia county)

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->onlyCounties()
  1. byPostalCode - search by zip code \ postal code

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->byPostalCode()
  1. continents - limit the search to selected continents

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->continents(['NA', 'SA'])

Available list of continents:

  • AF - Africa
  • AS - Asia
  • EU - Europe
  • NA - North America
  • OC - Oceania
  • SA - South America
  1. countries - limit the search to selected countries

use Enmaboya\PlaceInput\PlaceInput;

PlaceInput::make('some_place')->countries(['RU', 'US', 'CN', 'JP'])
  1. dependOnCountrySelect - If you use the County Select field, the search will be restricted to the country selected in County Select.

use Enmaboya\CountrySelect\CountrySelect;
use Enmaboya\PlaceInput\PlaceInput;

CountrySelect::make('Country', 'county_code');

PlaceInput::make('some_place')->dependOnCountrySelect('county_code'),

License

The MIT License (MIT). Please see License File for more information.