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


PHP Category::count方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CategoryRequest $request)
 {
     $category = new Category();
     // if ($request->hasFile('image'))
     // {
     //     $image = $request->file('image')->getClientOriginalName();
     //     $request->file('image')->move('img/categories/', $image);
     // }
     // else
     // {
     //     $image = 'no-image';
     // }
     $count = $category->count();
     if ($request->sort_id > 0) {
         $category->sort_id = $request->sort_id;
     } else {
         $category->sort_id = ++$count;
     }
     $category->section_id = $request->section_id;
     $category->title = $request->title;
     $category->slug = !empty($request->slug) ? $request->slug : str_slug($request->title);
     $category->image = $request->image;
     $category->title_description = $request->title_description;
     $category->meta_description = $request->meta_description;
     $category->text = $request->text;
     if ($request->status == 'on') {
         $category->status = 1;
     } else {
         $category->status = 0;
     }
     $category->save();
     return redirect('/admin/categories')->with('status', 'Категория добавлена!');
 }
开发者ID:vizovteam,项目名称:vizov,代码行数:38,代码来源:AdminCategoriesController.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: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     //App::setLocale('kh');
     //return trans('administrators.dashboard');
     //$user = Auth::user();
     //return $user->toJson();
     return View('admin.dashboard')->with(['user_total' => \App\User::count(), 'content_total' => \App\Content::count(), 'category_total' => \App\Category::count(), 'slider_total' => \App\Slider::count()]);
 }
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:14,代码来源:DashboardController.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: getCreate

 public function getCreate()
 {
     if (\Entrust::hasRole('Admin')) {
         if (Category::count()) {
             return view('a.productscreate')->with('cato', Category::lists('name', 'id'))->with('products', Product::all());
         } else {
             return redirect('admin/categories/view');
         }
     }
     return redirect('admin')->with('flash_message', 'You dont have permission to access create product page');
 }
开发者ID:alongmuaz,项目名称:laravel-fyp-cart,代码行数:11,代码来源:ProductController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts_published = Post::published()->count();
     $posts_editing = Post::where('published', 'uc')->count();
     $posts_sticky = Post::where('is_sticky', 'on')->count();
     $posts = Post::count();
     $users = User::count();
     $jobs = Job::count();
     $questions = Question::count();
     $categories = Category::count();
     return view('admin.stats.index', compact('posts', 'posts_published', 'posts_sticky', 'posts_editing', 'users', 'jobs', 'questions', 'categories'));
 }
开发者ID:celine24,项目名称:Back,代码行数:17,代码来源:StatsController.php

示例7: boot

 protected static function boot()
 {
     parent::boot();
     static::addGlobalScope('category', function (Builder $builder) {
         $builder->where('is_topic', 0)->where('is_ads', 0);
     });
     Category::creating(function ($category) {
         if (!$category->order) {
             $category->order = Category::count() + 1;
         }
     });
 }
开发者ID:JesadaMTK,项目名称:issara,代码行数:12,代码来源:Category.php


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