当前位置: 首页>>代码示例>>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;未经允许,请勿转载。