當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Item::orderByRaw方法代碼示例

本文整理匯總了PHP中app\Item::orderByRaw方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::orderByRaw方法的具體用法?PHP Item::orderByRaw怎麽用?PHP Item::orderByRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Item的用法示例。


在下文中一共展示了Item::orderByRaw方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 1; $i < 200; $i++) {
         $name = $faker->shuffle($faker->word()) . $faker->shuffle($faker->word());
         $recodeID = $faker->boolean(50) ? rand(0, $i) : NULL;
         $race = Race::orderByRaw("RAND()")->first();
         Character::create(['name' => $name, 'savename' => $name, 'class' => $faker->randomElement($array = array('A', 'B', 'C', 'D', 'S', 'SS', 'Z')), 'race' => $race->race, 'pot' => $faker->boolean(50), 'pof' => $faker->boolean(50), 'adventurer' => $faker->boolean(50), 'recode_id' => NULL]);
         for ($t = 1; $t < 4; $t++) {
             Job::create(['name' => $faker->shuffle($faker->name()), 'number' => $t, 'element' => $faker->randomElement($array = array('None', 'Fire', 'Ice', 'Darkness', 'Lightning', 'Heal', 'Remedy')), 'weapon' => $faker->randomElement($array = array('Sword', 'Bow', 'Spear', 'Staff')), 'minHP' => $faker->numberBetween(0, 130), 'maxHP' => $faker->numberBetween(200, 900), 'minATK' => $faker->numberBetween(0, 130), 'maxATK' => $faker->numberBetween(200, 900), 'minDEF' => $faker->numberBetween(0, 130), 'maxDEF' => $faker->numberBetween(200, 900), 'minMATK' => $faker->numberBetween(0, 130), 'maxMATK' => $faker->numberBetween(200, 900), 'minMDEF' => $faker->numberBetween(0, 130), 'maxMDEF' => $faker->numberBetween(200, 900), 'character_id' => $i]);
             for ($s = 1; $s < 5; $s++) {
                 $skill = Skill::orderByRaw("RAND()")->first();
                 $affection = Affection::orderByRaw("RAND()")->first();
                 JobSkill::create(['lvl' => rand(0, 15 * $s), 'skill_name' => $skill->name, 'affection' => $affection->affection, 'frequency' => rand(0, 101), 'job_id' => $t * $i]);
                 $item = Item::orderByRaw("RAND()")->first();
                 JobItem::create(['quantity' => rand(0, 51), 'item_name' => $item->name, 'job_id' => $t * $i]);
             }
         }
         for ($j = 0; $j < rand(1, 8); $j++) {
             Iteration::create(['trigger' => $faker->word(), 'content' => $faker->text(), 'character_id' => $i, 'trigger_id' => NULL]);
         }
     }
 }
開發者ID:benjides,項目名稱:terrabattlez,代碼行數:28,代碼來源:CharacterSeeder.php


注:本文中的app\Item::orderByRaw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。