Skip to content

BoatraceVentureProject/LaravelPrefecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Prefecture

Latest Stable Version Latest Unstable Version License

Installation

composer require bvp/laravel-prefecture

Usage

$collection = \Prefecture::all();
// $collection = prefecture()->all();
// $collection = app('prefecture')->all();
var_dump($collection->get(12)->get('id')); // int(13)
var_dump($collection->get(12)->get('name')); // string(9) "東京都"
var_dump($collection->get(12)->get('short_name')); // string(6) "東京"
var_dump($collection->get(12)->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get(12)->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get(12)->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::allId();
// $collection = prefecture()->allId();
// $collection = app('prefecture')->allId();
var_dump($collection->get(12)); // int(13)

$collection = \Prefecture::allName();
// $collection = prefecture()->allName();
// $collection = app('prefecture')->allName();
var_dump($collection->get(12)); // string(9) "東京都"

$collection = \Prefecture::allShortName();
// $collection = prefecture()->allShortName();
// $collection = app('prefecture')->allShortName();
var_dump($collection->get(12)); // string(6) "東京"

$collection = \Prefecture::allHiraganaName();
// $collection = prefecture()->allHiraganaName();
// $collection = app('prefecture')->allHiraganaName();
var_dump($collection->get(12)); // string(18) "とうきょうと"

$collection = \Prefecture::allKatakanaName();
// $collection = prefecture()->allKatakanaName();
// $collection = app('prefecture')->allKatakanaName();
var_dump($collection->get(12)); // string(18) "トウキョウト"

$collection = \Prefecture::allEnglishName();
// $collection = prefecture()->allEnglishName();
// $collection = app('prefecture')->allEnglishName();
var_dump($collection->get(12)); // string(5) "tokyo"

$collection = \Prefecture::allById(13, 34);
// $collection = prefecture()->allById(13, 34);
// $collection = app('prefecture')->allById(13, 34);
var_dump($collection->get(13)->get('id')); // int(13)
var_dump($collection->get(13)->get('name')); // string(9) "東京都"
var_dump($collection->get(13)->get('short_name')); // string(6) "東京"
var_dump($collection->get(13)->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get(13)->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get(13)->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::allByName('東京都', '広島県');
// $collection = prefecture()->allByName('東京都', '広島県');
// $collection = app('prefecture')->allByName('東京都', '広島県');
var_dump($collection->get('東京都')->get('id')); // int(13)
var_dump($collection->get('東京都')->get('name')); // string(9) "東京都"
var_dump($collection->get('東京都')->get('short_name')); // string(6) "東京"
var_dump($collection->get('東京都')->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('東京都')->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('東京都')->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::allByShortName('東京', '広島');
// $collection = prefecture()->allByShortName('東京', '広島');
// $collection = app('prefecture')->allByShortName('東京', '広島');
var_dump($collection->get('東京')->get('id')); // int(13)
var_dump($collection->get('東京')->get('name')); // string(9) "東京都"
var_dump($collection->get('東京')->get('short_name')); // string(6) "東京"
var_dump($collection->get('東京')->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('東京')->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('東京')->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::allByHiraganaName('とうきょうと', 'ひろしまけん');
// $collection = prefecture()->allByHiraganaName('とうきょうと', 'ひろしまけん');
// $collection = app('prefecture')->allByHiraganaName('とうきょうと', 'ひろしまけん');
var_dump($collection->get('とうきょうと')->get('id')); // int(13)
var_dump($collection->get('とうきょうと')->get('name')); // string(9) "東京都"
var_dump($collection->get('とうきょうと')->get('short_name')); // string(6) "東京"
var_dump($collection->get('とうきょうと')->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('とうきょうと')->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('とうきょうと')->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::allByKatakanaName('トウキョウト', 'ヒロシマケン');
// $collection = prefecture()->allByKatakanaName('トウキョウト', 'ヒロシマケン');
// $collection = app('prefecture')->allByKatakanaName('トウキョウト', 'ヒロシマケン');
var_dump($collection->get('トウキョウト')->get('id')); // int(13)
var_dump($collection->get('トウキョウト')->get('name')); // string(9) "東京都"
var_dump($collection->get('トウキョウト')->get('short_name')); // string(6) "東京"
var_dump($collection->get('トウキョウト')->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('トウキョウト')->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('トウキョウト')->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::allByEnglishName('tokyo', 'hiroshima');
// $collection = prefecture()->allByEnglishName('tokyo', 'hiroshima');
// $collection = app('prefecture')->allByEnglishName('tokyo', 'hiroshima');
var_dump($collection->get('tokyo')->get('id')); // int(13)
var_dump($collection->get('tokyo')->get('name')); // string(9) "東京都"
var_dump($collection->get('tokyo')->get('short_name')); // string(6) "東京"
var_dump($collection->get('tokyo')->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('tokyo')->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('tokyo')->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::byId(13);
// $collection = prefecture()->byId(13);
// $collection = app('prefecture')->byId(13);
var_dump($collection->get('id')); // int(13)
var_dump($collection->get('name')); // string(9) "東京都"
var_dump($collection->get('short_name')); // string(6) "東京"
var_dump($collection->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::byName('東京都');
// $collection = prefecture()->byName('東京都');
// $collection = app('prefecture')->byName('東京都');
var_dump($collection->get('id')); // int(13)
var_dump($collection->get('name')); // string(9) "東京都"
var_dump($collection->get('short_name')); // string(6) "東京"
var_dump($collection->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::byShortName('東京');
// $collection = prefecture()->byShortName('東京');
// $collection = app('prefecture')->byShortName('東京');
var_dump($collection->get('id')); // int(13)
var_dump($collection->get('name')); // string(9) "東京都"
var_dump($collection->get('short_name')); // string(6) "東京"
var_dump($collection->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::byHiraganaName('とうきょうと');
// $collection = prefecture()->byHiraganaName('とうきょうと');
// $collection = app('prefecture')->byHiraganaName('とうきょうと');
var_dump($collection->get('id')); // int(13)
var_dump($collection->get('name')); // string(9) "東京都"
var_dump($collection->get('short_name')); // string(6) "東京"
var_dump($collection->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::byKatakanaName('トウキョウト');
// $collection = prefecture()->byKatakanaName('トウキョウト');
// $collection = app('prefecture')->byKatakanaName('トウキョウト');
var_dump($collection->get('id')); // int(13)
var_dump($collection->get('name')); // string(9) "東京都"
var_dump($collection->get('short_name')); // string(6) "東京"
var_dump($collection->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('english_name')); // string(5) "tokyo"

$collection = \Prefecture::byEnglishName('tokyo');
// $collection = prefecture()->byEnglishName('tokyo');
// $collection = app('prefecture')->byEnglishName('tokyo');
var_dump($collection->get('id')); // int(13)
var_dump($collection->get('name')); // string(9) "東京都"
var_dump($collection->get('short_name')); // string(6) "東京"
var_dump($collection->get('hiragana_name')); // string(18) "とうきょうと"
var_dump($collection->get('katakana_name')); // string(18) "トウキョウト"
var_dump($collection->get('english_name')); // string(5) "tokyo"

License

The Laravel Prefecture is open source software licensed under the MIT license.