本文整理汇总了PHP中Tag::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::lists方法的具体用法?PHP Tag::lists怎么用?PHP Tag::lists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::lists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
$lessonIds = Lesson::lists('id');
$tagIds = Tag::lists('id');
foreach (range(1, 30) as $index) {
DB::table('lesson_tag')->insert(['lesson_id' => $faker->randomElement($lessonIds), 'tag_id' => $faker->randomElement($tagIds)]);
}
}
示例2: run
public function run()
{
$users = User::all();
$tags = Tag::lists('id');
$last = count($tags) - 1;
foreach ($users as $user) {
$user->tags()->attach($tags[rand(0, $last)]);
}
foreach ($users as $user) {
$user->tags()->attach($tags[rand(0, $last)]);
}
foreach ($users as $user) {
$user->tags()->attach($tags[rand(0, $last)]);
}
}
示例3: run
public function run()
{
$tutorials = Tutorial::all();
$tags = Tag::lists('id');
$last = count($tags) - 1;
foreach ($tutorials as $tutorial) {
$tutorial->tags()->attach($tags[rand(0, $last)]);
}
foreach ($tutorials as $tutorial) {
$tutorial->tags()->attach($tags[rand(0, $last)]);
}
foreach ($tutorials as $tutorial) {
$tutorial->tags()->attach($tags[rand(0, $last)]);
}
}
示例4: run
public function run()
{
$qas = Qa::all();
$tags = Tag::lists('id');
$last = count($tags) - 1;
foreach ($qas as $qa) {
$qa->tags()->attach($tags[rand(0, $last)]);
}
foreach ($qas as $qa) {
$qa->tags()->attach($tags[rand(0, $last)]);
}
foreach ($qas as $qa) {
$qa->tags()->attach($tags[rand(0, $last)]);
}
}
示例5: getIDs
public static function getIDs()
{
return Tag::lists('id');
}
示例6: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$tags = Tag::lists('name', 'id');
$article = Article::find($id);
return View::make('articles.edit', compact('article', 'tags'));
}