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


PHP Region::create方法代码示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $regions = ['', '---', 'sev', 'simf', 'ubk', 'evp', 'feo'];
     foreach ($regions as $region) {
         Region::create(['id' => $region]);
     }
 }
开发者ID:mazhuravlev,项目名称:olx-grabber,代码行数:12,代码来源:RegionsSeeder.php

示例2: run

 public function run()
 {
     DB::table('regions')->delete();
     $regions = $this->api('database.getRegions', ['country_id' => 2]);
     foreach ($regions['response'] as $region) {
         Region::create(['name' => $region['title']]);
     }
 }
开发者ID:Retsediv,项目名称:edu,代码行数:8,代码来源:RegionTableSeeder.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Region $region, StoreRegion $request)
 {
     $region->create($request->all());
     $request->session()->flash('alert-success', 'Регион успешно добавлен!');
     return redirect('regions');
 }
开发者ID:kostik34,项目名称:trains.shop,代码行数:11,代码来源:RegionController.php

示例4: store

 public function store(Request $request)
 {
     $this->store_validation_rules($request);
     $date_open = $this->saved_date_format($request->input('date_open'));
     $request->merge(array('date_open' => $date_open));
     $region = $request->input();
     Region::create($region);
     Session::flash('flash_message', 'Data berhasil ditambahkan!');
     return redirect('master/regions');
 }
开发者ID:thesaputra,项目名称:xyz-prx,代码行数:10,代码来源:RegionController.php

示例5: parseTenders

 protected function parseTenders(Client $client, Crawler $crawler)
 {
     $repeatSensor = 0;
     $contractsNum = 0;
     $crawler->filter('div.registerBox')->each(function (Crawler $node, $i) use($client, &$repeatSensor, &$contractsNum) {
         $systemId = str_replace('№ ', '', trim($node->filter('td.descriptTenderTd > dl > dt > a')->text()));
         $organizationNode = $node->filter('dd.nameOrganization > a');
         $organizationName = trim($organizationNode->text());
         $organizationUrl = trim($organizationNode->attr('href'));
         //Log::info('Node data', [$node->html()]);
         $contractName = trim($node->filter('td.descriptTenderTd > dl > dd')->eq(1)->text());
         $contractUrl = $node->filter('td.descriptTenderTd > dl > dt > a')->attr('href');
         $contractType = trim($node->filter('td.tenderTd > dl > dt')->eq(0)->text());
         $contractStatus = '';
         /*Log::info('Обработка нового контракта', [
               'org_name' => $organizationName,
               'org_url' => $organizationUrl,
               'name' => $contractName,
               'url' => $contractUrl
           ]);*/
         $contract = Contract::where('system_id', $systemId)->first();
         if (!$contract) {
             $repeatSensor = 0;
             // Search organization in database
             $organization = Organization::where('url', $organizationUrl)->first();
             if (!$organization) {
                 //Log::info('Организация не найдена, добавляем в базу.');
                 $organization = new Organization();
                 $organization->name = $organizationName;
                 $organization->url = $organizationUrl;
                 $this->info($organizationUrl);
                 $organizationResponse = $client->get($organizationUrl);
                 $organizationCrawler = new Crawler((string) $organizationResponse->getBody());
                 //Log::info('Информация по организации загружена.');
                 // Federal Law 223
                 if (preg_match("/223\\/ppa/", $organizationUrl)) {
                     $organizationCrawler->filter('div.noticeTabBoxWrapper > table tr')->each(function (Crawler $row, $j) use(&$organization) {
                         if ($row->children('td')->count() > 1) {
                             $nameColumn = trim($row->children('td')->eq(0)->text());
                             $valueColumn = trim($row->children('td')->eq(1)->text());
                             if ($valueColumn) {
                                 switch ($nameColumn) {
                                     case 'Уровень организации':
                                         $organization->level = $valueColumn;
                                         break;
                                     case 'ИНН':
                                         $organization->inn = $valueColumn;
                                         break;
                                     case 'КПП':
                                         $organization->kpp = $valueColumn;
                                         break;
                                     case 'ОГРН':
                                         $organization->ogrn = $valueColumn;
                                         break;
                                     case 'ОКАТО':
                                         $organization->okato = $valueColumn;
                                         break;
                                     case 'Адрес (место нахождения)':
                                         $addresses = array_map(function ($value) {
                                             return trim($value);
                                         }, explode(',', $valueColumn));
                                         $address = collect($addresses);
                                         $address->forget('Российская Федерация');
                                         $organization->postal_code = $address[0];
                                         $organization->country_id = 1;
                                         $country = Country::find(1);
                                         if (isset($address[3])) {
                                             $region = Region::where('name', $address[2])->where('country_id', $country->id)->first();
                                             if (!$region) {
                                                 $region = Region::create(['country_id' => $country->id, 'name' => $address[2]]);
                                             }
                                             $town = Town::where('name', $address[3])->where('region_id', $region->id)->first();
                                             if (!$town) {
                                                 $town = Town::create(['region_id' => $region->id, 'name' => $address[3]]);
                                             }
                                             $organization->region_id = $region->id;
                                             $organization->town_id = $town->id;
                                         }
                                         $organization->address = $valueColumn;
                                         break;
                                     case 'Телефон':
                                         $organization->contact_phone = $valueColumn;
                                         break;
                                     case 'Факс':
                                         $organization->contact_fax = $valueColumn;
                                         break;
                                     case 'Почтовый адрес':
                                         $organization->contact_address = $valueColumn;
                                         break;
                                     case 'Контактное лицо':
                                         $organization->contact_name = $valueColumn;
                                         break;
                                     case 'Адрес электронной почты для системных уведомлений':
                                         $organization->contact_email = $valueColumn;
                                         break;
                                 }
                             }
                         }
                     });
                 } else {
//.........这里部分代码省略.........
开发者ID:6akcuk,项目名称:infotendermail,代码行数:101,代码来源:DownloadContracts.php


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