laracountries, 迁移和种子文件与 Laravel PHP框架的所有国家.zip

  • P0_410417
    了解作者
  • 5.6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-27 00:43
    上传日期
laracountries, 迁移和种子文件与 Laravel PHP框架的所有国家 Laracountries迁移和种子文件与 Laravel PHP框架的所有国家。国家代码格式为 ISO alpha-2 。一个简单的使用示例( Laravel 5 )模型<?phpuse Illum
laracountries.zip
  • laracountries-master
  • database
  • migrations
  • create_countries_table.php
    622B
  • seeds
  • CountriesTableSeeder.php
    13.8KB
  • LICENSE
    1.1KB
  • README.md
    1005B
内容介绍
# Laracountries Migration and seed files with all countries for Laravel PHP Framework. The country codes are in the format [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). ## A Simple Example of Use (Laravel 5) #### Model ```php <?php use Illuminate\Database\Eloquent\Model; class Country extends Model { protected $table = 'countries'; public $timestamps = false; } ``` #### Controller ```php /** * Show the form for creating a new resource. * * @return View */ public function create() { $countries = Country::all(); return view('myview', compact('countries')); } ``` #### View ```html <select class="form-control" name="country"> <option value="">Select a country</option> @foreach($countries as $country) <option value="{{ $country->id }}">{{ $country->name }}</option> @endforeach </select> ``` ## License Copyright (c) 2015 [Fábio Santos](http://www.fabiosantos.me). See the LICENSE file for license rights and limitations (MIT).
评论
    相关推荐