當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tag::lists方法代碼示例

本文整理匯總了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)]);
     }
 }
開發者ID:rudihartomo,項目名稱:Laravel-RestAPI,代碼行數:9,代碼來源:LessontagTableSeeder.php

示例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)]);
     }
 }
開發者ID:automotivecapstone,項目名稱:capstone.dev,代碼行數:15,代碼來源:TagUserTableSeeder.php

示例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)]);
     }
 }
開發者ID:automotivecapstone,項目名稱:capstone.dev,代碼行數:15,代碼來源:TagTutorialsTableSeeder.php

示例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)]);
     }
 }
開發者ID:automotivecapstone,項目名稱:capstone.dev,代碼行數:15,代碼來源:QaTagTableSeeder.php

示例5: getIDs

 public static function getIDs()
 {
     return Tag::lists('id');
 }
開發者ID:rituzy,項目名稱:iblog,代碼行數:4,代碼來源:Tag.php

示例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'));
 }
開發者ID:j-beere,項目名稱:laravel-blog,代碼行數:12,代碼來源:ArticlesController.php


注:本文中的Tag::lists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。