marshmallow / address-prefiller
此包将根据邮政编码和门牌号码获取完整的地址信息。目前支持在线荷兰地址。
v2.1.0
2023-09-21 08:24 UTC
Requires
- php: >=7.1.0
- dev-main
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/npm_and_yarn/minimist-1.2.8
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-and-express-6.11.0
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/minimatch-3.1.2
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/follow-redirects-1.14.8
This package is auto-updated.
Last update: 2024-09-21 10:51:07 UTC
README
Nova 可翻译
此包将根据提供的邮政编码和门牌号码自动填写地址字段。目前仅支持荷兰地址。可用于自定义应用程序或与 Laravel Nova 一起使用。
安装
通过 Composer 安装包
通过 Composer 在 Laravel 项目中安装此包。
# Install the package
composer require marshmallow/address-prefiller
Nova 中的使用
有一个自定义 Laravel Nova 字段可供使用。这非常类似于 Laravel Place 字段。不同之处在于,此字段不会与 Algolia 通信,而是与荷兰政府提供的官方公开 API 通信,其中应包含所有最新信息。
public function fields(Request $request) { return [ ID::make()->sortable(), $this->addressFields(), ]; } protected function addressFields() { return $this->merge([ Zipcode::make(__('Zipcode prefiller'), __('Zipcode'), __('Housenumber')) /** * Let the package know which columns are connected to * the fields. The default values are commented after each * function call. Is your column names match these defaults, * you don't need to call all these functions. */ ->zipcode('zipcode') ->housenumber('address_2') ->street('address_1') ->city('city') ->province('province') ->country('country') ->latitude('latitude') ->longitude('longitude'), /** * The field below will all be prefilled with the collected * data if we find a match on the submitted zipcode and housenumber. */ Hidden::make(__('Zipcode'), 'zipcode')->hideFromIndex(), Hidden::make(__('Housenumber'), 'address_2')->hideFromIndex(), Text::make(__('Street'), 'address_1')->hideFromIndex(), Text::make(__('City'), 'city')->hideFromIndex(), Text::make(__('Province'), 'province')->hideFromIndex(), Country::make(__('Country'), 'country')->hideFromIndex(), Text::make(__('Latitude'), 'latitude')->hideFromIndex(), Text::make(__('Longitude'), 'longitude')->hideFromIndex(), ]); }
手动使用
我们提供了一个示例,说明如何在您的应用程序中使用此功能。我们目前在 Nova 设置中使用此功能,如果您缺少任何内容,请告诉我们!
use Marshmallow\Zipcode\Facades\Zipcode; return Zipcode::get( $request->zipcode, $request->housenumber );
测试
composer test
安全
如果您发现任何安全问题,请通过电子邮件 stef@marshmallow.dev 反馈,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证 (MIT)。请参阅许可证文件获取更多信息。