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


PHP Region::makeFirstChildOf方法代码示例

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


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

示例1: run


//.........这里部分代码省略.........
     $regions['Victoria'] = [];
     $regions['Victoria']['Central Victoria']['Bendigo'] = [];
     $regions['Victoria']['Central Victoria']['Goulburn Valley']['Nagambie Lakes'] = [];
     $regions['Victoria']['Central Victoria']['Heathcote'] = [];
     $regions['Victoria']['Central Victoria']['Strathbogie Ranges'] = [];
     $regions['Victoria']['Central Victoria']['Upper Goulburn'] = [];
     $regions['Victoria']['Gippsland'] = [];
     $regions['Victoria']['North East Victoria']['Alpine Valleys'] = [];
     $regions['Victoria']['North East Victoria']['Beechworth'] = [];
     $regions['Victoria']['North East Victoria']['Glenrowan'] = [];
     $regions['Victoria']['North East Victoria']['King Valley'] = [];
     $regions['Victoria']['North East Victoria']['Rutherglen'] = [];
     $regions['Victoria']['North West Victoria']['Murray Darling'] = [];
     $regions['Victoria']['North West Victoria']['Swan Hill'] = [];
     $regions['Victoria']['Port Phillip']['Geelong'] = [];
     $regions['Victoria']['Port Phillip']['Macedon Ranges'] = [];
     $regions['Victoria']['Port Phillip']['Mornington Peninsula'] = [];
     $regions['Victoria']['Port Phillip']['Sunbury'] = [];
     $regions['Victoria']['Port Phillip']['Yarra Valley'] = [];
     $regions['Victoria']['Western Victoria']['Grampians']['Great Western'] = [];
     $regions['Victoria']['Western Victoria']['Henty'] = [];
     $regions['Victoria']['Western Victoria']['Pyrenees'] = [];
     $regions['Tasmania'] = [];
     $regions['Northern Territory'] = [];
     $regions['Australian Capital Territory'] = [];
     foreach ($regions as $region => $children) {
         $this->makeChild($country, $region, $children, $depths);
     }
     // ---------------------------
     $new = new Region(['name' => 'South Eastern Australia', 'region_type_id' => 5]);
     $new->makeLastChildOf($country);
     $subzones = Region::whereIn('name', ['New South Wales', 'South Australia', 'Queensland', 'Victoria'])->get();
     foreach ($subzones as $subzone) {
         $subzone = new Region(['name' => $subzone->name, 'region_type_id' => 2, 'shortcut_id' => $subzone->id]);
         $subzone->makeLastChildOf($new);
     }
     // ---------------------------
     $existing = Region::whereName('South Australia')->first();
     $new = new Region(['name' => 'Adelaide', 'region_type_id' => 5]);
     $new->makeFirstChildOf($existing);
     $subzones = Region::whereIn('name', ['Mount Lofty Ranges', 'Fleurieu', 'Barossa'])->get();
     foreach ($subzones as $subzone) {
         $subzone = new Region(['name' => $subzone->name, 'region_type_id' => 6, 'shortcut_id' => $subzone->id]);
         $subzone->makeLastChildOf($new);
     }
     // ---------------------------
     $existing = Region::whereName('Murray Darling')->get();
     $first = $existing->first();
     $last = $existing->last();
     $last->shortcut_id = $first->id;
     $last->save();
     // ---------------------------
     $existing = Region::whereName('Swan Hill')->get();
     $first = $existing->first();
     $last = $existing->last();
     $last->shortcut_id = $first->id;
     $last->save();
     // ---------------------------
     $depths = [1, 7, 8];
     $country = new Region(['name' => 'New Zealand', 'region_type_id' => array_shift($depths)]);
     $country->makeRoot();
     $regions = [];
     $regions["Northland"] = [];
     $regions["Auckland"] = [];
     $regions["Auckland"]["Waiheke Island"] = [];
     $regions["Auckland"]["Henderson"] = [];
     $regions["Auckland"]["Clevedon"] = [];
     $regions["Auckland"]["Matakana"] = [];
     $regions["Auckland"]["Kumeu"] = [];
     $regions["Waikato"] = [];
     $regions["Bay of Plenty"] = [];
     $regions["Gisborne"] = [];
     $regions["Hawke's Bay"] = [];
     $regions["Hawke's Bay"]["Gimblett Gravels"] = [];
     $regions["Wairarapa"] = [];
     $regions["Wairarapa"]["Carterton"] = [];
     $regions["Wairarapa"]["Masterton"] = [];
     $regions["Wairarapa"]["South Wairarapa"] = [];
     $regions["Wairarapa"]["Martinborough"] = [];
     $regions["Marlborough"] = [];
     $regions["Marlborough"]["Southern Valleys"] = [];
     $regions["Marlborough"]["Wairau Valley"] = [];
     $regions["Marlborough"]["Awatere Valley"] = [];
     $regions["Nelson"] = [];
     $regions["Nelson"]["Moutere"] = [];
     $regions["Nelson"]["Brightwater"] = [];
     $regions["Canterbury/ Waipara Valley"] = [];
     $regions["Central Otago"] = [];
     $regions["Central Otago"]["Wanaka"] = [];
     $regions["Central Otago"]["Gibbston"] = [];
     $regions["Central Otago"]["Bannockburn"] = [];
     $regions["Central Otago"]["Alexandra"] = [];
     $regions["Central Otago"]["Roxburgh"] = [];
     $regions["Central Otago"]["Bendigo"] = [];
     $regions["Central Otago"]["Lowburn/ Pisa"] = [];
     $regions["Central Otago"]["Cromwell"] = [];
     foreach ($regions as $region => $children) {
         $this->makeChild($country, $region, $children, $depths);
     }
 }
开发者ID:kitbs,项目名称:vinfo,代码行数:101,代码来源:RegionsTableSeeder.php


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