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


PHP Tag::count方法代码示例

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


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

示例1: index

 public function index()
 {
     $userCount = User::count();
     $articleCount = Article::count();
     $tagCount = Tag::count();
     $imageCount = Image::count();
     return view('admin.index', compact('userCount', 'articleCount', 'imageCount', 'tagCount'));
 }
开发者ID:litemax,项目名称:LaravelBlog,代码行数:8,代码来源:IndexController.php

示例2: index

 public function index()
 {
     $article_count = Article::count();
     $category_count = Category::count();
     $tag_count = Tag::count();
     $user_count = User::count();
     return view('admin.console', compact('article_count', 'category_count', 'tag_count', 'user_count'));
 }
开发者ID:axhello,项目名称:laravel-blog-demo,代码行数:8,代码来源:AdminController.php

示例3: about

 /**
  * About us page
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function about(Request $request)
 {
     $data['designer_number'] = Designer::count();
     $data['design_number'] = Design::count();
     $data['place_number'] = Place::count();
     $data['story_number'] = Story::count();
     $data['tag_number'] = Tag::count();
     $data['user_number'] = User::count();
     $data['city_number'] = City::has('places')->orHas('designers')->count();
     return view('pages.about', $data);
 }
开发者ID:santakani,项目名称:santakani.com,代码行数:17,代码来源:PageController.php

示例4: composeDashboard

 private function composeDashboard()
 {
     view()->composer('admin.index', function ($view) {
         $numArticle = \App\Article::count();
         $numCategory = \App\Category::count();
         $numTag = \App\Tag::count();
         $numProject = \App\Project::count();
         $numMessage = \App\Message::count();
         $view->with(compact('numArticle', 'numCategory', 'numTag', 'numProject', 'numMessage'));
     });
 }
开发者ID:ambarsetyawan,项目名称:laravel5-blog-1,代码行数:11,代码来源:DashboardViewComposerServiceProvider.php

示例5: testItSendsEmailToInterestedSubscribers

 /**
  * Assert that emails are sent using the command send:email
  *
  * @return void
  */
 public function testItSendsEmailToInterestedSubscribers()
 {
     $totalSubscribers = Subscription::count();
     $subscriber = factory(Subscription::class)->create(['confirmed' => true, 'active' => true]);
     $this->assertTrue($totalSubscribers < Subscription::count());
     $subscriber->topics()->detach();
     foreach (Tag::all() as $tag) {
         $subscriber->topics()->save($tag);
     }
     $this->assertTrue($subscriber->topics()->get()->count() == Tag::count());
     // $this->expectsJobs(SendNewsletter::class);
     Artisan::call("emails:send", ['timestamp' => 1]);
     $logFile = file_get_contents(storage_path() . '/logs/laravel.log');
     $this->assertTrue(strpos($logFile, $subscriber->email) !== false);
 }
开发者ID:joaumg-deprecated,项目名称:joaumg_com,代码行数:20,代码来源:CommandSendEmailTest.php

示例6: run

 public function run()
 {
     $shuffle = function ($tags, $num) {
         $s = [];
         while ($num > 0) {
             $s[] = $tags[$num];
             $num--;
         }
         return $s;
     };
     $max = Tag::count();
     $tags = Tag::lists('id');
     factory(App\Product::class, 15)->create()->each(function ($product) use($max, $tags, $shuffle) {
         $product->tags()->attach($shuffle($tags, rand(1, $max - 1)));
     });
 }
开发者ID:Laurent91700,项目名称:Star-Wars,代码行数:16,代码来源:ProductTableSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|max:255', 'category_id' => 'required|numeric']);
     $tag = new Tag();
     $count = $tag->count();
     if ($request->sort_id > 0) {
         $tag->sort_id = $request->sort_id;
     } else {
         $tag->sort_id = ++$count;
     }
     $tag->category_id = $request->category_id;
     $tag->slug = str_slug($request->title);
     $tag->title = $request->title;
     if ($request->status == 'on') {
         $tag->status = 1;
     } else {
         $tag->status = 0;
     }
     $tag->save();
     return redirect()->back()->with('status', 'Тег создан!');
 }
开发者ID:vizovteam,项目名称:vizov,代码行数:27,代码来源:AdminTagsController.php


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