当前位置: 首页>>代码示例>>PHP>>正文


PHP Country::create方法代码示例

本文整理汇总了PHP中app\models\Country::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::create方法的具体用法?PHP Country::create怎么用?PHP Country::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Country的用法示例。


在下文中一共展示了Country::create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('Countries')->delete();
     Country::create(['id' => 1, 'country_name' => 'Lithuania']);
     Country::create(['id' => 2, 'country_name' => 'Russia']);
     Country::create(['id' => 3, 'country_name' => 'Germany']);
 }
开发者ID:ruslankus,项目名称:lavarel-lessons,代码行数:12,代码来源:CountrySeeder.php

示例2: run

 public function run()
 {
     DB::table('users')->delete();
     $VK = new VK(env('VK_APP_ID'), env('VK_KEY_SECRET'));
     $vkCountries = $VK->api('database.getCountries', ['need_all' => 1, 'count' => 1000, 'lang' => 'ru']);
     foreach ($vkCountries['response'] as $country) {
         Country::create(['id' => $country['cid'], 'title' => $country['title']]);
     }
 }
开发者ID:Nataliia-IG,项目名称:adsk,代码行数:9,代码来源:countries_api_vk.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $this->command->info('Start country seeder!');
     $countries = $this->getCountryArray();
     foreach ($countries as $code => $name) {
         Country::create(['name' => $name, 'code' => $code]);
     }
     $this->command->info('Country table seeded!');
 }
开发者ID:e-tipalchuk,项目名称:address-search-microservice,代码行数:14,代码来源:CountryTableSeeder.php

示例4: createStartingCountries

 private static function createStartingCountries(Field $field)
 {
     $countries = new Collection();
     for ($x = 0; $x < \Config::get('settings.fieldWidth'); $x++) {
         for ($y = 0; $y < \Config::get('settings.fieldHeight'); $y++) {
             $countries->push(Country::create(['x' => $x, 'y' => $y, 'field_id' => $field->id]));
         }
     }
     return $countries;
 }
开发者ID:JJacobi13,项目名称:jcAiBattle,代码行数:10,代码来源:Field.php

示例5: update

 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Country::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
开发者ID:RHT-Memphis,项目名称:adc,代码行数:11,代码来源:CountriesController.php

示例6: handle

 /**
  * Execute the job.
  *
  * @param Country $country
  */
 public function handle(Country $country)
 {
     /**
      * Save all Countries
      */
     $this->countries->transform(function ($name, $code) use($country) {
         return $country->create(compact('name', 'code'));
     });
     /**
      * Announce CountryWasCreated
      */
     event(new CountryWasCreated($this->countries->toArray()));
 }
开发者ID:SkysoulDesign,项目名称:mirage.dev,代码行数:18,代码来源:CreateCountryJob.php

示例7: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('country', function (Blueprint $table) {
         $table->engine = 'InnoDB';
         $table->string('code', 2)->primary()->unique();
         $table->string('name')->index();
         $table->string('local_name')->index();
         $table->timestamps();
     });
     // FIXTURES EU Countries
     $data = [];
     $file = file_get_contents(base_path() . '/database/fixtures/countries.csv');
     $lines = str_getcsv($file, "\n");
     foreach ($lines as $line) {
         $keys = ['local_name', 'name', 'code'];
         $row = array_combine($keys, str_getcsv($line, ';'));
         Country::create($row);
     }
 }
开发者ID:AccessibilityNL,项目名称:User-Testing-Tool,代码行数:24,代码来源:2015_09_01_100000_create_country.php

示例8: run

  public function run ()
  {
  
    DB::table('countries')->delete();

    Country::create([

      'cname' => '中国',

      'ename' => 'China',

      'code' => 1,

      'active' => 1

    ]);
  
  
  }
开发者ID:kukujiabo,项目名称:linpai,代码行数:19,代码来源:CountriesTableSeeder.php


注:本文中的app\models\Country::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。