本文整理匯總了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'));
}