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


PHP Tag::all方法代码示例

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


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

示例1: composeSidebar

 /**
  * Compose the sidebar.
  */
 private function composeSidebar()
 {
     view()->composer('partials.sidebar', function ($view) {
         $view->with('latest', Article::published()->orderBy('id', 'desc')->take(5)->get());
         $view->with('tags', Tag::all());
     });
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:10,代码来源:ViewComposerServiceProvider.php

示例2: generatePopular

 /**
  * Generate or regenerate popular Discover Cache items
  *
  * @param SearchHandlerInterface $searchHandler
  * @param CacheHandlerInterface $cacheHandler
  */
 public function generatePopular(SearchHandlerInterface $searchHandler, CacheHandlerInterface $cacheHandler)
 {
     $tags = Tag::all()->groupBy('name')->orderBy('created_at')->take(20)->get();
     foreach ($tags as $tag) {
         $this->generate($tag, $cacheHandler, $searchHandler);
     }
 }
开发者ID:brycenrogers,项目名称:linken,代码行数:13,代码来源:DiscoverCacheHandler.php

示例3: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('tags', function (Blueprint $table) {
         $table->string('slug')->nullable();
     });
     //Trigger save on each tag to generate slug
     foreach (\App\Models\Tag::all() as $tag) {
         $tag->save();
     }
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:15,代码来源:2016_01_02_113343_add_slug_to_tags_table.php

示例4: getTag

 public function getTag()
 {
     $tags = Tag::all();
     return Datatables::of($tags)->edit_column('status', function ($row) {
         return showSelectStatus($row->id, $row->status, 'Kacana.product.tag.setStatusTag(' . $row->id . ', 1)', 'Kacana.product.tag.setStatusTag(' . $row->id . ', 0)');
     })->edit_column('created', function ($row) {
         return showDate($row->created);
     })->edit_column('updated', function ($row) {
         return showDate($row->updated);
     })->add_column('action', function ($row) {
         return showActionButton('Kacana.product.tag.showEditTagForm(' . $row->id . ')', 'Kacana.product.tag.removeTag(' . $row->id . ')', true);
     })->make(true);
 }
开发者ID:kacana,项目名称:admin,代码行数:13,代码来源:TagController.php

示例5: addTags

 public function addTags($tags = [])
 {
     $rowTagsName = Tag::all(['name'])->toArray();
     $rowTagsName = array_flatten($rowTagsName);
     foreach ($tags as $key => $tag) {
         if (in_array($tag, $rowTagsName)) {
         } else {
             $tag = new Tag();
             $tag->name = $tag;
             $tag->save();
         }
     }
 }
开发者ID:limahfud,项目名称:skripsi,代码行数:13,代码来源:Product.php

示例6: testProfileNonEmptySkillsMatrix

 /**
  * Checks that skills/stars/flags are correct
  *
  * (Have to decide an ordering here - probably alphabetical on skill name, case-insensitive)
  */
 public function testProfileNonEmptySkillsMatrix()
 {
     $faker = Faker\Factory::create();
     factory(App\Models\Profile::class, 'withAUser', 1)->create();
     factory(App\Models\Tag::class, 3)->create();
     $profile = App\Models\Profile::first();
     $rating = 5;
     foreach (App\Models\Tag::all() as $tag) {
         $seeking = $faker->boolean;
         $offering = $faker->boolean;
         $profile->add_tag($tag, $rating, $seeking, $offering);
         $tags[] = [$tag->name, $rating, $seeking, $offering];
         $rating = $rating - 1;
     }
     $this->visit(route('profile.view', ['name' => $profile->user->username]))->see('seeInElement', '.rating:nth-child(1)', 6)->see('seeInElement', '.rating:nth-child(2)', 4)->see('seeInElement', '.rating:nth-child(3)', 2);
 }
开发者ID:khoparzi,项目名称:PairUp,代码行数:21,代码来源:ProfileViewTest.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $tags = Tag::all();
     $skills = Skill::all();
     for ($i = 0; $i < 50; $i++) {
         $user = User::register($faker->unique()->userName, $faker->unique()->email, bcrypt('password'), 'talent');
         $this->userRepository->save($user);
         $profileData = ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'location' => $faker->city, 'describe' => $faker->numberBetween(1, count($skills) - 1), 'about' => $faker->sentence(), 'facebook' => $faker->userName, 'linked_in' => $faker->userName, 'twitter' => $faker->userName, 'meetup' => $faker->userName, 'published' => $faker->boolean()];
         $userSkills = '';
         foreach (range(1, rand(2, 4)) as $x) {
             $id = rand(1, count($tags) - 1);
             $userSkills .= $tags[$id]->name . ",";
         }
         $profileData['skills'] = $userSkills;
         $this->dispatcher->dispatch(new UpdateProfile($user, $profileData));
     }
 }
开发者ID:katzumi,项目名称:talent4startups,代码行数:23,代码来源:UserTableSeeder.php

示例8: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $author = User::whereHas('role', function ($q) {
         $q->where('slug', 'admin');
     })->first();
     $categories = Category::where('is_active', 1)->get();
     $postsRecents = Post::where('is_active', 1)->where('seen', 1)->orderBy('created_at', 'desc')->take(3)->get();
     $postsPopular = Post::where('is_active', 1)->where('seen', 1)->orderBy('nview', 'desc')->take(3)->get();
     $commentsRecents = Comment::where('seen', 1)->orderBy('created_at', 'desc')->take(3)->get();
     $tags = Tag::all();
     $INFO_SITE = Admin::first();
     view()->share('author', $author);
     view()->share('categories', $categories);
     view()->share('tags', $tags);
     view()->share('postsRecents', $postsRecents);
     view()->share('postsPopular', $postsPopular);
     view()->share('commentsRecents', $commentsRecents);
     view()->share('INFO_SITE', $INFO_SITE);
 }
开发者ID:doankhoi,项目名称:Application,代码行数:24,代码来源:AppServiceProvider.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $slugify = Slugify::create();
     $users = User::all();
     $tags = Tag::all();
     $skills = Skill::all();
     foreach ($users as $user) {
         foreach (range(1, rand(2, 3)) as $i) {
             $name = $faker->name;
             $startup = Startup::create(['name' => $name, 'description' => $faker->text, 'url' => $slugify->slugify($name), 'user_id' => $user->id, 'published' => true]);
             $this->repository->save($startup);
             $startupTags = [];
             foreach (range(1, rand(2, 4)) as $i) {
                 $id = rand(1, count($tags) - 1);
                 $startupTags[] = $id;
             }
             $needs = [];
             $commitments = ['full-time', 'part-time'];
             foreach (range(1, rand(2, 3)) as $i) {
                 $roleId = rand(1, count($skills) - 1);
                 $needTags = [];
                 foreach (range(1, rand(2, 3)) as $i) {
                     $id = rand(1, count($tags) - 1);
                     $needTags[] = $id;
                 }
                 $needs[] = array('role' => $roleId, 'quantity' => rand(1, 10), 'skills' => implode(',', $needTags), 'commitment' => $commitments[rand(0, 1)], 'desc' => $faker->text);
                 $this->repository->updateNeeds($startup, $needs);
             }
             $startup->tags()->attach($startupTags);
             foreach (range(1, rand(2, 3)) as $i) {
                 $id = rand(1, count($users) - 1);
                 if ($startup->owner->id !== $id) {
                     $this->repository->addMemberRequest($users[$id], $startup, false);
                     if (rand(0, 1)) {
                         $this->repository->approveMemberRequest($users[$id], $startup, false);
                     }
                 }
             }
         }
     }
 }
开发者ID:katzumi,项目名称:talent4startups,代码行数:47,代码来源:StartupTableSeeder.php

示例10: galeria

 function galeria()
 {
     $posts = \App\Models\Post::all();
     $tags = \App\Models\Tag::all();
     $tagsUsados = [];
     $tagsTotal = [];
     $contTags = 0;
     $contTagsTotal = 0;
     foreach ($posts as $p) {
         foreach ($p->tags as $t) {
             $tagsUsados[$contTags] = $t->clave;
             $contTags++;
         }
     }
     foreach ($tags as $tag) {
         $tagsTotal[$contTagsTotal] = $tag->clave;
         $contTagsTotal++;
     }
     $tagsUsadosNeto = array_intersect($tagsTotal, $tagsUsados);
     return view('front.galeria')->with(array('posts' => $posts, 'tags' => $tags, 'tt' => $tagsUsadosNeto));
 }
开发者ID:Pacotreflip,项目名称:gci,代码行数:21,代码来源:PostController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $tags = Tag::all();
     return view('admin.tag.index')->withTags($tags);
 }
开发者ID:cdandy,项目名称:meta-admin,代码行数:11,代码来源:TagController.php

示例12: getTags

 /**
  * @param $factId
  * @return \Illuminate\Database\Eloquent\Collection|static[]
  */
 public function getTags($factId)
 {
     if (!is_null($factId)) {
         $fact = Fact::find($factId);
         $fact ? $tags = $fact->tags : ($tags = null);
         return $tags;
     }
     $tags = Tag::all();
     return $tags;
 }
开发者ID:RichNwankwo,项目名称:Gladysrepo,代码行数:14,代码来源:TagController.php

示例13: all

 public function all()
 {
     return Tag::all();
 }
开发者ID:go-labs,项目名称:php_rest_poc,代码行数:4,代码来源:EloquentTagRepository.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tags = Tag::all();
     return view('admin.tags.index')->with('tags', $tags);
 }
开发者ID:jclyons52,项目名称:mycourse-rocks,代码行数:10,代码来源:TagController.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $posts = Post::latest()->get();
     $tags = Tag::all();
     return view('blog.posts', ['posts' => $posts, 'tags' => $tags]);
 }
开发者ID:scotthummel,项目名称:piscean,代码行数:11,代码来源:PostsController.php


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