本文整理汇总了PHP中app\models\Product::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::lists方法的具体用法?PHP Product::lists怎么用?PHP Product::lists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::lists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
$products = c2a(Product::lists('id'));
$users = c2a(User::lists('id'));
foreach (range(1, 20) as $index) {
Topic::create(['title' => $faker->sentence(6), 'slug' => $faker->name, 'product_id' => $faker->randomElement($products), 'user_id' => $faker->randomElement($users), 'keywords' => $faker->sentence, 'description' => $faker->sentence(10), 'content' => $faker->sentence(100), 'page_view_count' => rand(10, 3059), 'vote_count' => rand(0, 199), 'reply_count' => rand(0, 100)]);
}
}
示例2: show
public function show($id)
{
$data = ['order' => Order::findOrFail($id), 'products' => Product::lists('name', 'id')];
return view('order.edit', $data);
}
示例3: edit
public function edit($id)
{
$productionRegister = ProductionRegister::with('product')->findOrFail($id);
$products = Product::lists('title', 'id');
return view('productionRegisters.edit', compact('productionRegister', 'products'));
}
示例4: edit
/**
* Show the form for editing the specified Tracking.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
$tracking = $this->trackingRepository->findWithoutFail($id);
$facings = Facing::lists('name', 'id');
$products = Product::lists('name', 'id');
$brands = Brand::lists('name', 'id');
$users = User::lists('name', 'id');
if (empty($tracking)) {
Flash::error('Tracking not found');
return redirect(route('trackings.index'));
}
return view('trackings.edit')->with('tracking', $tracking)->with('facings', $facings)->with('products', $products)->with('brands', $brands)->with('users', $users);
}
示例5: composeLessonForm
private function composeLessonForm()
{
view()->composer('site.lessons.fields', function ($view) {
$view->with('products', \App\Models\Product::lists('name', 'id'))->with('links', \App\Models\Link::lists('name', 'id'));
});
}