本文整理汇总了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();
}
}
}