Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the extension of Laravel World

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "how to use the extension of Laravel World". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Laravel World-country and city data with its own database (Chinese supported)

Laravel World (https://github.com/nnjeim/world) is a package that provides a list of countries, states, cities, currencies, and time zones. World integrates data with the Eloquent model through a database and provides Facades, helper, and API routing:

Use Nnjeim\ World\ World;$action = World::countries () / * {"success": true, "message": "countries", "data": [{"id": 1, "name": "Afghanistan"}, {"id": 2, "name": "land Islands"},...],} * /

This is another example in readme, which uses a filter to get the country and cities within that country:

/ / get country and city $action = World::countries (['fields' = >' states,cities', 'filters' = > [' iso2' = > 'FR',]]) / * {"success": true, "message": "countries", "data": ["id": 77, "name": "France", "states": [{"id": 1271, "name": "Alo"}, {"id": 1272 "name": "Alsace"},], "cities": [{"id": 25148, "name": "Abondance"}, {"id": 25149, "name": "Abrest"} []],} * / "how to use Laravel World extensions" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report