kinatechsolutions/world-data

世界数据包包括国家、州、城市、货币和语言

1.0.1 2023-01-11 13:32 UTC

This package is auto-updated.

Last update: 2024-09-11 17:48:55 UTC


README

一个laravel包,提供包括国家、城市、货币、邮政编码和语言的全球数据列表。

安装

要安装此包,请运行

  composer require kinatechsolutions/world-data

然后运行迁移来创建数据库表。

 php artisan migrate

要使用数据填充您的模型,请运行

 php artisan world:populate

使用/示例

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Kinatech\World\Facade\World;

class MyController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function index()
    {

        $postalCodes = World::postalCode()
            ->where('country_code', 'KE')
            ->get();

        $countries = World::country()->get();
        $states = World::state()->get();
        $cities = World::city()->get();
        $languages = World::language()->get();
        $currencies = World::currency()->get();
        
        return response()->json([
            'data' => $postalCodes
        ]);
    }
}

贡献

贡献总是受欢迎的!

请参阅contributing.md以了解如何开始。

请遵守本项目的行为准则

作者

许可证

MIT许可证(MIT)。请参阅许可证文件获取更多信息。