laravelarab / data-source
该软件包已被废弃,不再维护。未建议替代包。
此软件包将提供网站所有者在未来可能需要的所有数据:D
v0.2
2017-03-10 19:30 UTC
This package is auto-updated.
Last update: 2021-01-06 03:07:34 UTC
README
此软件包将提供网站所有者在未来可能需要的所有数据:D
安装
目前安装 DataSource 的唯一方法是 composer,或者您可以像以前一样手动克隆此仓库或下载它。
$ composer require laravelarab/data-source
将此行添加到您的 /config/app.php
文件中的 providers 数组末尾
LaravelArab\DataSource\DataSourceServiceProvider::class,
并将其添加到同一文件的 aliases 数组中
'DataSource' => LaravelArab\DataSource\Facades\DataSource::class,
然后您可以运行
$ php artisan vendor:publish --tag=config
说明
注意: 目前可用的唯一数据是国家和州以及城市。
DataSource::countries(); // get all countries DataSource::states(); // get all states DataSource::cities(); // get all cities DataSource::country($id); // get country by id DataSource::country($id)->states; // get country States DataSource::country($id)->cities; // get county Cities DataSource::state($id); // get state by id DataSource::state($id)->country; // get state Country DataSource::state($id)->cities; // get state Cities DataSource::city($id); // get city by id DataSource::city($id)->country; // get city Country DataSource::city($id)->state; // get city State DataSource::countryByCode($code); // get Country by code e.g: MA DataSource::countryByName($name); // get Country by name e.g: Morocco DataSource::stateByName($name); // get State by name e.g: Tangier-Tetouan DataSource::cityByName($name); // get City by name e.g: Titwan // you can access properties name & id & code for example DataSource::country($id)->id; DataSource::country($id)->name; DataSource::country($id)->code; DataSource::countryByCode($code)->name; DataSource::countryByName($name)->code; // you can also do this with state and cities DataSource::state($id)->id; DataSource::state($id)->name; DataSource::state($id)->country_id; DataSource::city($id)->id; DataSource::city($id)->name; DataSource::city($id)->country_id; DataSource::city($id)->state_id;
许可
MIT
自由软件,太棒了!