Giter Site home page Giter Site logo

imo-tikuwa / select2-and-auto-zip-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 201 KB

Laravel(非VueSPA)の環境でselect2を使用したプルダウンの動的な変更とyubinbangoの住所自動入力を組み合せたプログラムのサンプル

Shell 0.71% PHP 72.76% Blade 26.52%

select2-and-auto-zip-example's Introduction

このリポジトリについて

  • Laravel Sailを使用した環境構築及び、Laravel(非VueSPA)の環境でselect2とyubinbango.jsの住所自動入力を組み合せたプログラムのサンプル
    • 入力した郵便番号を元にselect2を使用した都道府県と市区町村のプルダウンを動的に切り替える
    • 市区町村は都道府県の選択値を元にあらかじめpublic以下に廃止した市区町村の一覧jsonを参照して動的にプルダウンの選択肢を切り替える
    • 市区町村の一覧はRESASの市区町村APIから取得したものを使用
      • .envのRESAS_API_KEYにAPIキーをセットした状態でphp artisan create:city_json実行することでpublic以下に最新のjsonを配置
      • もしかしたらyubinbango.jsが返す市区町村と一致しないケースがあるかもしれない
  • jquery,select2,bootstrap4などについてlaravel-mixは使用せずCDNの参照とする
  • sail up -d後、http://localhostにアクセスすることで動作確認可能
    • フォーム内の送信ボタンはPOST送信後の値保持が出来てることを確認するためのもの

image

クローン後の環境構築手順(未検証)

composer install
cp .env.example .env
php artisan key:generate
wsl
vendor/bin/sail up -d
vendor/bin/sail exec laravel.test php artisan migrate
vendor/bin/sail exec laravel.test php artisan db:seed

.envの改行コードがCRLFだと/.env: line 〇〇: $'\r': command not foundというエラーが出るためLFに変換しておいた方が良いかもしれない。

select2-and-auto-zip-example's People

Contributors

imo-tikuwa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.