本文整理汇总了PHP中Region::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::create方法的具体用法?PHP Region::create怎么用?PHP Region::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
// Nation
DB::table('nations')->delete();
Nation::create(array('libelle' => '---', 'code' => 'xxx'));
Nation::create(array('libelle' => 'Belgique', 'code' => 'be'));
Nation::create(array('libelle' => 'France', 'code' => 'fr'));
Nation::create(array('libelle' => 'Luxembourg', 'code' => 'lu'));
// Region
DB::table('regions')->delete();
// Belgique
Region::create(array('nation_id' => 1, 'libelle' => '---'));
Region::create(array('nation_id' => 2, 'libelle' => 'Anvers'));
Region::create(array('nation_id' => 2, 'libelle' => 'Brabant Flamand'));
Region::create(array('nation_id' => 2, 'libelle' => 'Brabant Wallon'));
Region::create(array('nation_id' => 2, 'libelle' => 'Bruxelles'));
Region::create(array('nation_id' => 2, 'libelle' => 'Flandre Occidentale'));
Region::create(array('nation_id' => 2, 'libelle' => 'Flandre Orientale'));
Region::create(array('nation_id' => 2, 'libelle' => 'Limbourg'));
Region::create(array('nation_id' => 2, 'libelle' => 'Hainaut'));
Region::create(array('nation_id' => 2, 'libelle' => 'Liège'));
Region::create(array('nation_id' => 2, 'libelle' => 'Luxembourg'));
Region::create(array('nation_id' => 2, 'libelle' => 'Namur'));
// France
Region::create(array('nation_id' => 3, 'libelle' => 'Alsace'));
Region::create(array('nation_id' => 3, 'libelle' => 'Aquitaine'));
Region::create(array('nation_id' => 3, 'libelle' => 'Auvergne'));
Region::create(array('nation_id' => 3, 'libelle' => 'Basse Normandie'));
Region::create(array('nation_id' => 3, 'libelle' => 'Bourgogne'));
Region::create(array('nation_id' => 3, 'libelle' => 'Bretagne'));
Region::create(array('nation_id' => 3, 'libelle' => 'Centre'));
Region::create(array('nation_id' => 3, 'libelle' => 'Champagne Ardennes'));
Region::create(array('nation_id' => 3, 'libelle' => 'Corse'));
Region::create(array('nation_id' => 3, 'libelle' => 'Franche Comte'));
Region::create(array('nation_id' => 3, 'libelle' => 'Guadeloupe'));
Region::create(array('nation_id' => 3, 'libelle' => 'Guyanne'));
Region::create(array('nation_id' => 3, 'libelle' => 'Normandie'));
Region::create(array('nation_id' => 3, 'libelle' => 'Ile de France'));
Region::create(array('nation_id' => 3, 'libelle' => 'La Réunion'));
Region::create(array('nation_id' => 3, 'libelle' => 'Languedoc Roussillon'));
Region::create(array('nation_id' => 3, 'libelle' => 'Limousin'));
Region::create(array('nation_id' => 3, 'libelle' => 'Lorraine'));
Region::create(array('nation_id' => 3, 'libelle' => 'Martinique'));
Region::create(array('nation_id' => 3, 'libelle' => 'Midi Pyrennées'));
Region::create(array('nation_id' => 3, 'libelle' => 'Nord Pas-de-Calais'));
Region::create(array('nation_id' => 3, 'libelle' => 'Nouvelle Calédonie'));
Region::create(array('nation_id' => 3, 'libelle' => 'Paca'));
Region::create(array('nation_id' => 3, 'libelle' => 'Pays de Loire'));
Region::create(array('nation_id' => 3, 'libelle' => 'Picardie'));
Region::create(array('nation_id' => 3, 'libelle' => 'Poitoi Charentes'));
Region::create(array('nation_id' => 3, 'libelle' => 'Rhones Alpes'));
Region::create(array('nation_id' => 3, 'libelle' => 'Territoire Outre Mer'));
// Luxembourg
Region::create(array('nation_id' => 4, 'libelle' => 'Luxembourg'));
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
Region::create(['Name' => 'organ', 'Format' => 'zone', 'Groups' => '["boundary", "no-flux", "tissues", "organs"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::Liver)->addSegmentationType(SegmentationTypeEnum::Lung)->addSegmentationType(SegmentationTypeEnum::Kidney)->addSegmentationType(SegmentationTypeEnum::Prostate);
Region::create(['Name' => 'veins', 'Format' => 'surface', 'Groups' => '["vessels", "veins"]', 'Segmentation' => '']);
Region::create(['Name' => 'arteries', 'Format' => 'surface', 'Groups' => '["vessels", "arteries"]', 'Segmentation' => '']);
Region::create(['Name' => 'vessels', 'Format' => 'surface', 'Groups' => '["vessels"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::Vessels);
Region::create(['Name' => 'tumour', 'Format' => 'zone', 'Groups' => '["tumours"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::Tumor);
Region::create(['Name' => 'bronchi', 'Format' => 'surface', 'Groups' => '["bronchi"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::Bronchi);
Region::create(['Name' => 'segmented-lesion', 'Format' => 'zone', 'Groups' => '["segmented-lesions"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::Lesion);
Region::create(['Name' => 'existing-lesion', 'Format' => 'zone', 'Groups' => '["lesions"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::Simulation);
Region::create(['Name' => 'tace', 'Format' => 'zone', 'Groups' => '["tace"]', 'Segmentation' => ''])->addSegmentationType(SegmentationTypeEnum::TACE);
}
示例3: run
public function run()
{
DB::table("regions")->delete();
Region::create(array("name" => "South Coast - Inland", "url" => "south-coast", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "North Columbia - Cariboos", "url" => "cariboos", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "North Columbia - Monashees and Selkirks", "url" => "monashees-selkirks", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "South Columbia", "url" => "south-columbia", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Purcells", "url" => "purcells", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Kootenay Boundary", "url" => "kootenay-boundary", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Lizard Range", "url" => "lizardrange", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "South Rockies", "url" => "south-rockies", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Northwest Inland", "url" => "northwest-inland", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Northwest Coastal", "url" => "northwest-coastal", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "North Shore", "url" => "north-shore", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Sea To Sky", "url" => "sea-to-sky", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Kananaskis Country", "url" => "kananaskis", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Whistler Blackcomb", "url" => "whistler-blackcomb", "country" => "CA", "hashtag" => ""));
Region::create(array("name" => "Yukon", "url" => "yukon", "country" => "CA", "hashtag" => ""));
}
示例4: run
public function run()
{
Region::create(array("name" => "Floor 1 - Disabled", "capacity" => 5, "spots_occupied" => 4, 'lot_id' => 1));
Region::create(array("name" => "Floor 1 - General", "capacity" => 227, "spots_occupied" => 227, 'lot_id' => 1));
Region::create(array("name" => "Floor 2 - General", "capacity" => 227, "spots_occupied" => 198, 'lot_id' => 1));
Region::create(array("name" => "Floor 3 - General", "capacity" => 227, "spots_occupied" => 201, 'lot_id' => 1));
Region::create(array("name" => "Floor 4 - General", "capacity" => 227, "spots_occupied" => 176, 'lot_id' => 1));
Region::create(array("name" => "Floor 5 - General", "capacity" => 227, "spots_occupied" => 100, 'lot_id' => 1));
Region::create(array("name" => "Floor 1 - Employee", "capacity" => 386, "spots_occupied" => 234, 'lot_id' => 2));
Region::create(array("name" => "Floor 1 - Disabled", "capacity" => 48, "spots_occupied" => 7, 'lot_id' => 2));
Region::create(array("name" => "Floor 1 - R-Permit Only", "capacity" => 5, "spots_occupied" => 0, 'lot_id' => 2));
Region::create(array("name" => "Floor 1 - 20-Minute Time Zone", "capacity" => 12, "spots_occupied" => 12, 'lot_id' => 2));
Region::create(array("name" => "Floor 2 - General", "capacity" => 375, "spots_occupied" => 374, 'lot_id' => 2));
Region::create(array("name" => "Floor 3 - General", "capacity" => 375, "spots_occupied" => 299, 'lot_id' => 2));
Region::create(array("name" => "Floor 4 - General", "capacity" => 375, "spots_occupied" => 343, 'lot_id' => 2));
Region::create(array("name" => "Floor 5 - General", "capacity" => 375, "spots_occupied" => 123, 'lot_id' => 2));
Region::create(array("name" => "Floor 1 - Disabled", "capacity" => 8, "spots_occupied" => 7, 'lot_id' => 3));
Region::create(array("name" => "Floor 1 - R-Permit Only", "capacity" => 7, "spots_occupied" => 1, 'lot_id' => 3));
Region::create(array("name" => "Floor 1 - 30-Minute Time Zone", "capacity" => 29, "spots_occupied" => 27, 'lot_id' => 3));
Region::create(array("name" => "Floor 1 - Employee", "capacity" => 177, "spots_occupied" => 150, 'lot_id' => 3));
Region::create(array("name" => "Floor 2 - Employee", "capacity" => 177, "spots_occupied" => 100, 'lot_id' => 3));
Region::create(array("name" => "Floor 2 - General", "capacity" => 90, "spots_occupied" => 90, 'lot_id' => 3));
Region::create(array("name" => "Floor 3 - General", "capacity" => 280, "spots_occupied" => 175, 'lot_id' => 3));
Region::create(array("name" => "Floor 4 - General", "capacity" => 280, "spots_occupied" => 242, 'lot_id' => 3));
Region::create(array("name" => "Floor 5 - General", "capacity" => 280, "spots_occupied" => 185, 'lot_id' => 3));
Region::create(array("name" => "Floor 6 - General", "capacity" => 280, "spots_occupied" => 112, 'lot_id' => 3));
// Uncomment to use Faker
/*$faker = Faker::create();
for ($i= 0; $i < 5; $i++) {
Region::create(array(
'name' => 'Region ' . ($i + 1),
'capacity' => $faker->numberBetween(10, 40),
'spots_occupied' => $faker->numberBetween(10, 40),
'lot_id' => 1
));
}
for ($i= 0; $i < 5; $i++) {
Region::create(array(
'name' => 'Region ' . ($i + 1),
'capacity' => $faker->numberBetween(10, 40),
'spots_occupied' => $faker->numberBetween(10, 40),
'lot_id' => 2
));
}
for ($i= 0; $i < 5; $i++) {
Region::create(array(
'name' => 'Region ' . ($i + 1),
'capacity' => $faker->numberBetween(10, 40),
'spots_occupied' => $faker->numberBetween(10, 40),
'lot_id' => 3
));
}
for ($i= 0; $i < 5; $i++) {
Region::create(array(
'name' => 'Region ' . ($i + 1),
'capacity' => $faker->numberBetween(10, 40),
'spots_occupied' => $faker->numberBetween(10, 40),
'lot_id' => 4
));
}
for ($i= 0; $i < 5; $i++) {
Region::create(array(
'name' => 'Region ' . ($i + 1),
'capacity' => $faker->numberBetween(10, 40),
'spots_occupied' => $faker->numberBetween(10, 40),
'lot_id' => 5
));
}
for ($i= 0; $i < 5; $i++) {
Region::create(array(
'name' => 'Region ' . ($i + 1),
'capacity' => $faker->numberBetween(10, 40),
'spots_occupied' => $faker->numberBetween(10, 40),
'lot_id' => 6
));
}*/
}
示例5: array_push
array_push($errors, "Invalid name!");
}
if ($p_name == '') {
$success = false;
array_push($errors, "The name field is required !");
}
if ($p_slug != '' && !preg_match('/^[a-zA-Z0-9_-]*$/', $p_slug)) {
$success = false;
array_push($errors, "Invalid slug!");
}
if ($p_slug == '') {
$success = false;
array_push($errors, "The slug field is required !");
}
if ($success) {
$last = Region::create(array('name' => $p_name, 'slug' => $p_slug), $p_parent);
}
}
if (isset($_POST['region_slug_generate'])) {
$p_parent = (int) $_POST['parent'];
$p_name = trim($_POST['name']);
$success = false;
$errors = array();
if ($p_name == '' || $p_name != '' && !preg_match('/^[\\w- ]*$/u', $p_name)) {
$success = false;
array_push($errors, "Invalid name!");
} else {
$p_slug = slug($p_name);
}
}
$regions = Region::get_all(array('parent' => 0));