本文整理汇总了PHP中Region::makeRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::makeRoot方法的具体用法?PHP Region::makeRoot怎么用?PHP Region::makeRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::makeRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('regions')->delete();
$depths = [1, 2, 6, 7, 8];
$country = new Region(['name' => 'Australia', 'region_type_id' => array_shift($depths)]);
$country->makeRoot();
$regions = [];
$regions['South Australia'] = [];
$regions['South Australia']['Barossa']['Barossa Valley'] = [];
$regions['South Australia']['Barossa']['Eden Valley']['High Eden'] = [];
$regions['South Australia']['Far North']['Southern Flinders Ranges'] = [];
$regions['South Australia']['Fleurieu']['Currency Creek'] = [];
$regions['South Australia']['Fleurieu']['Kangaroo Island'] = [];
$regions['South Australia']['Fleurieu']['Langhorne Creek'] = [];
$regions['South Australia']['Fleurieu']['McLaren Vale'] = [];
$regions['South Australia']['Fleurieu']['Southern Fleurieu'] = [];
$regions['South Australia']['Limestone Coast']['Coonawarra'] = [];
$regions['South Australia']['Limestone Coast']['Mount Benson'] = [];
$regions['South Australia']['Limestone Coast']['Mount Gambier'] = [];
$regions['South Australia']['Limestone Coast']['Padthaway'] = [];
$regions['South Australia']['Limestone Coast']['Robe'] = [];
$regions['South Australia']['Limestone Coast']['Wrattonbully'] = [];
$regions['South Australia']['Lower Murray']['Riverland'] = [];
$regions['South Australia']['Mount Lofty Ranges']['Adelaide Hills']['Lenswood'] = [];
$regions['South Australia']['Mount Lofty Ranges']['Adelaide Hills']['Piccadilly Valley'] = [];
$regions['South Australia']['Mount Lofty Ranges']['Adelaide Plains'] = [];
$regions['South Australia']['Mount Lofty Ranges']['Clare Valley'] = [];
$regions['South Australia']['The Peninsulas'] = [];
$regions['New South Wales'] = [];
$regions['New South Wales']['Big Rivers']['Murray Darling'] = [];
$regions['New South Wales']['Big Rivers']['Perricoota'] = [];
$regions['New South Wales']['Big Rivers']['Riverina'] = [];
$regions['New South Wales']['Big Rivers']['Swan Hill'] = [];
$regions['New South Wales']['Central Ranges']['Cowra'] = [];
$regions['New South Wales']['Central Ranges']['Mudgee'] = [];
$regions['New South Wales']['Central Ranges']['Orange'] = [];
$regions['New South Wales']['Hunter Valley']['Hunter']['Broke Fordwich'] = [];
$regions['New South Wales']['Hunter Valley']['Hunter']['Pokolbin'] = [];
$regions['New South Wales']['Hunter Valley']['Hunter']['Upper Hunter Valley'] = [];
$regions['New South Wales']['Northern Rivers']['Hastings River'] = [];
$regions['New South Wales']['Northern Slopes']['New England Australia'] = [];
$regions['New South Wales']['South Coast']['Shoalhaven Coast'] = [];
$regions['New South Wales']['South Coast']['Southern Highlands'] = [];
$regions['New South Wales']['Southern New South Wales']['Canberra District'] = [];
$regions['New South Wales']['Southern New South Wales']['Gundagai'] = [];
$regions['New South Wales']['Southern New South Wales']['Hilltops'] = [];
$regions['New South Wales']['Southern New South Wales']['Tumbarumba'] = [];
$regions['Western Australia'] = [];
$regions['Western Australia']['Central Western Australia'] = [];
$regions['Western Australia']['Eastern Plains - Inland and North of Western Australia'] = [];
$regions['Western Australia']['Greater Perth']['Peel'] = [];
$regions['Western Australia']['Greater Perth']['Perth Hills'] = [];
$regions['Western Australia']['Greater Perth']['Swan District']['Swan Valley'] = [];
$regions['Western Australia']['South West Australia']['Blackwood Valley'] = [];
$regions['Western Australia']['South West Australia']['Geographe'] = [];
$regions['Western Australia']['South West Australia']['Great Southern']['Albany'] = [];
$regions['Western Australia']['South West Australia']['Great Southern']['Denmark'] = [];
$regions['Western Australia']['South West Australia']['Great Southern']['Frankland River'] = [];
$regions['Western Australia']['South West Australia']['Great Southern']['Mount Barker'] = [];
$regions['Western Australia']['South West Australia']['Great Southern']['Porongurup'] = [];
$regions['Western Australia']['South West Australia']['Manjimup'] = [];
$regions['Western Australia']['South West Australia']['Margaret River'] = [];
$regions['Western Australia']['South West Australia']['Pemberton'] = [];
$regions['Western Australia']['West Australian South East Coastal'] = [];
$regions['Queensland'] = [];
$regions['Queensland']['Granite Belt'] = [];
$regions['Queensland']['South Burnett'] = [];
$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) {
//.........这里部分代码省略.........