当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::lists方法代码示例

本文整理汇总了PHP中app\models\Tag::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::lists方法的具体用法?PHP Tag::lists怎么用?PHP Tag::lists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Tag的用法示例。


在下文中一共展示了Tag::lists方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 public function edit($id)
 {
     $article = Article::findOrFail($id);
     //Calls for tag list
     $tags = Tag::lists('name', 'id');
     return view('articles.edit', compact('article', 'tags'));
 }
开发者ID:shep1990,项目名称:scorpio_studios,代码行数:7,代码来源:ArticleController.php

示例2: 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::with("tags")->find($id);
     $categories = Category::lists("name", "id");
     //        dd($article->tags->lists("id"));
     return view("dashboard.articles.edit", compact("article", "categories", "tags"));
 }
开发者ID:bassx1,项目名称:lessons,代码行数:14,代码来源:ArticlesController.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $lessonIds = \App\Models\Lesson::lists('id')->toArray();
     $tagIds = \App\Models\Tag::lists('id')->toArray();
     foreach (range(1, 30) as $index) {
         DB::table('lesson_tag')->insert(['lesson_id' => $faker->randomElement($lessonIds), 'tag_id' => $faker->randomElement($tagIds)]);
     }
 }
开发者ID:nbinkunwar,项目名称:laravel5_rest,代码行数:14,代码来源:LessonTagTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $topics = c2a(Topic::lists('id'));
     $tags = c2a(Tag::lists('id'));
     foreach (range(0, 30) as $index) {
         topic_tag_relationship::create(['topic_id' => $faker->randomElement($topics), 'tag_id' => $faker->randomElement($tags)]);
     }
 }
开发者ID:jiketao,项目名称:jiketao-laravel,代码行数:14,代码来源:topic_tag_relationshipsTableSeeder.php

示例5: run

 public function run()
 {
     $faker = Faker::create();
     $tags = Tag::lists('id')->toArray();
     for ($i = 1; $i <= 50; $i++) {
         PostTag::create(['post_id' => $i, 'tag_id' => $faker->randomElement($tags)]);
         PostTag::create(['post_id' => $i, 'tag_id' => $faker->randomElement($tags)]);
         PostTag::create(['post_id' => $i, 'tag_id' => $faker->randomElement($tags)]);
     }
 }
开发者ID:forehalo,项目名称:materialize-blog,代码行数:10,代码来源:DatabaseSeeder.php

示例6: editPreparation

 public function editPreparation($product)
 {
     $item = Item::find($product->organizations->first()->pivot->id);
     $itemtags = $item->tags->lists(['id'])->toArray();
     $book = $product->is;
     $bookauthors = $book->authors->lists(['id'])->toArray();
     $categories = $this->getCategoriesByRecursion($item->cat_id);
     $authors = Author::get()->lists('full_name', 'id');
     $editors = ['' => ''] + Editor::lists('e_name', 'id')->all();
     $tags = Tag::lists('tag_name', 'id');
     return compact('product', 'itemtags', 'authors', 'editors', 'categories', 'tags', 'book', 'item', 'bookauthors', 'categories');
 }
开发者ID:nicsmyrn,项目名称:library,代码行数:12,代码来源:DbBookRepository.php

示例7: updateMap

 public function updateMap($request)
 {
     $id = $request->route('map');
     $map = Map::findOrFail($id);
     $values = $request->except('_token', '_method', '_section', 'tags');
     $map->fill($values);
     if ($request->has('tags') && is_array($request->tags)) {
         $tagList = Tag::lists('id')->toArray();
         $cleanTags = array_intersect($request->tags, $tagList);
         $map->tags()->sync($cleanTags);
     }
     return $map->save();
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:13,代码来源:MapRepository.php

示例8: handle

 /**
  * Execute the command.
  *
  * @return array of fieldnames => values
  */
 public function handle()
 {
     $fields = $this->fieldList;
     if ($this->id) {
         $fields = $this->fieldsFromModel($this->id, $fields);
     } else {
         $when = Carbon::now()->addHour();
         $fields['publish_date'] = $when->format('M-j-Y');
         $fields['publish_time'] = $when->format('g:i A');
     }
     foreach ($fields as $fieldName => $fieldValue) {
         $fields[$fieldName] = old($fieldName, $fieldValue);
     }
     return array_merge($fields, ['allTags' => Tag::lists('tag')->all()]);
 }
开发者ID:kientrunghuynh,项目名称:elsa-blog,代码行数:20,代码来源:PostFormFields.php

示例9: run

 /**
  * Seed the posts table
  */
 public function run()
 {
     // Pull all the tag names from the file
     $tags = Tag::lists('tag')->all();
     Post::truncate();
     // Don't forget to truncate the pivot table
     DB::table('post_tag_pivot')->truncate();
     factory(Post::class, 20)->create()->each(function ($post) use($tags) {
         // 30% of the time don't assign a tag
         if (mt_rand(1, 100) <= 30) {
             return;
         }
         shuffle($tags);
         $postTags = [$tags[0]];
         // 30% of the time we're assigning tags, assign 2
         if (mt_rand(1, 100) <= 30) {
             $postTags[] = $tags[1];
         }
         $post->syncTags($postTags);
     });
 }
开发者ID:kientrunghuynh,项目名称:elsa-blog,代码行数:24,代码来源:PostTableSeeder.php

示例10: edit

 /**
  * @param $startup
  * @return $this
  */
 public function edit($startup)
 {
     $startup = Startup::where('url', '=', $startup)->firstOrFail();
     $tags = Tag::lists('name', 'id')->all();
     $stages = Stage::lists('name', 'id')->all();
     $needs = Skill::lists('name', 'id')->all();
     return view('startups.edit')->with('startup', $startup)->with('tags', $tags)->with('stages', $stages)->with('needs', $needs);
 }
开发者ID:katzumi,项目名称:talent4startups,代码行数:12,代码来源:StartupController.php

示例11: edit

 public function edit(Article $article)
 {
     $tags = Tag::lists('name', 'id');
     return view('article.edit', compact('article', 'tags'));
 }
开发者ID:ruslankus,项目名称:lavarel-lessons,代码行数:5,代码来源:ArticleController.php

示例12: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $tags = Tag::lists('name', 'id');
     return view('forum.create', compact('tags'));
 }
开发者ID:xiaoyang4011,项目名称:discuss,代码行数:10,代码来源:DiscussionController.php

示例13: function

$factory->define(Issue::class, function (Generator $faker) use($dates) {
    return array_merge(['issue' => $faker->unique()->numberBetween(1, 30), 'published_at' => $faker->dateTimeThisYear], $dates);
});
// 文章
$factory->define(PublishingArticle::class, function (Generator $faker) use($dates) {
    $issues = Issue::lists('issue')->toArray();
    $categoryIds = Category::lists('id')->toArray();
    return array_merge(['issue' => $faker->randomElement($issues), 'category_id' => $faker->randomElement($categoryIds), 'title' => $faker->sentence(), 'desc' => $faker->paragraph, 'url' => $faker->url, 'presenter' => $faker->name], $dates);
});
// 投稿
$factory->define(ContributeArticle::class, function (Generator $faker) use($dates) {
    return array_merge(['title' => $faker->sentence(), 'desc' => $faker->paragraph, 'url' => $faker->url, 'presenter' => $faker->name], $dates);
});
// 文章标签
$factory->define(Tag::class, function (Generator $faker) use($dates) {
    return array_merge(['name' => $faker->unique()->word], $dates);
});
// 文章和标签之间的关联关系
$factory->define(Taggable::class, function (Generator $faker) use($dates) {
    $taggableIds = PublishingArticle::lists('id')->toArray();
    $tagIds = Tag::lists('id')->toArray();
    return ['tag_id' => $faker->randomElement($tagIds), 'taggable_id' => $faker->randomElement($taggableIds), 'taggable_type' => $faker->randomElement([PublishingArticle::class, ContributeArticle::class])];
});
// 订阅用户
$factory->define(Subscribe::class, function (Generator $faker) use($dates) {
    return array_merge(['name' => $faker->name, 'email' => $faker->unique()->email, 'confirm_code' => getVerifyCode(), 'is_confirmed' => $faker->randomElement([0, 1])], $dates);
});
// 系统配置
$factory->define(SystemSetting::class, function (Generator $faker) {
    return ['website_title' => 'Kratos', 'website_keywords' => 'K', 'website_dsec' => '', 'website_icp' => '', 'page_size' => '10', 'system_version' => 'alpha_1.0', 'system_author' => 'Kratos', 'system_author_website' => 'Kratos'];
});
开发者ID:axex,项目名称:kratos,代码行数:31,代码来源:ModelFactory.php

示例14: composeProductsForm

 public function composeProductsForm()
 {
     view()->composer('site.products.fields', function ($view) {
         $view->with('categories', \App\Models\Category::lists('name', 'id'))->with('tags', \App\Models\Tag::lists('name', 'id'))->with('files', \App\Fileentry::lists('original_filename', 'id'));
     });
 }
开发者ID:jclyons52,项目名称:mycourse-rocks,代码行数:6,代码来源:ViewComposerServiceProvider.php


注:本文中的app\models\Tag::lists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。