本文整理汇总了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]);
}
}
示例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']]);
}
}
示例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');
}
示例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');
}
示例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 {
//.........这里部分代码省略.........