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


PHP Item::itemInfo方法代碼示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $item1 = ItemInfo::create(['name' => 'lucky charms']);
     $item2 = ItemInfo::create(['name' => 'chicken']);
     $item3 = ItemInfo::create(['name' => 'coke']);
     $item4 = ItemInfo::create(['name' => 'frozen pizza']);
     $item5 = ItemInfo::create(['name' => 'sprite']);
     $item6 = ItemInfo::create(['name' => 'pepsi']);
     $item7 = ItemInfo::create(['name' => 'mtn dew']);
     $item8 = ItemInfo::create(['name' => 'crackers']);
     $item9 = ItemInfo::create(['name' => 'breakfast bar']);
     $item10 = ItemInfo::create(['name' => 'shrimp']);
     $item11 = ItemInfo::create(['name' => 'hot dogs']);
     $item12 = ItemInfo::create(['name' => 'hot dog buns']);
     $item13 = ItemInfo::create(['name' => 'mustard']);
     $item14 = ItemInfo::create(['name' => 'pickle']);
     $item15 = ItemInfo::create(['name' => 'banana']);
     $item16 = ItemInfo::create(['name' => 'apple']);
     $item17 = ItemInfo::create(['name' => 'bacon']);
     $item18 = ItemInfo::create(['name' => 'hot pocket']);
     $item19 = ItemInfo::create(['name' => 'orange juice']);
     $item20 = ItemInfo::create(['name' => 'candy']);
     $items = [$item1, $item2, $item3, $item4, $item5, $item6, $item7, $item8, $item9, $item10, $item11, $item12, $item13, $item14, $item15, $item16, $item17, $item18, $item19, $item20];
     $stores = Store::all();
     /* Generate these 4 items for each store with random prices between
     	       $1.00 and $6.00 (100 - 600 in DB)
     		*/
     foreach ($stores as $store) {
         foreach ($items as $item) {
             $i = new Item();
             $i->price = rand(100, 600);
             $i->store()->associate($store);
             $i->itemInfo()->associate($item);
             $i->save();
         }
     }
 }
開發者ID:GoBuyHere,項目名稱:GoBuyHere,代碼行數:42,代碼來源:ItemSeeder.php


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