本文整理汇总了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'));
}
示例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'));
}
示例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);
}
示例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'));
});
}
示例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);
}
示例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)));
});
}
示例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', 'Тег создан!');
}