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


PHP Category::all方法代码示例

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


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

示例1: getList

 /**
  * Get a list of categories
  *
  * @return static
  */
 public function getList()
 {
     $categories = $this->category->all();
     $response = $categories->map(function ($item) {
         return ["id" => $item->id, "name" => $item->name];
     });
     return $response;
 }
开发者ID:daninoz,项目名称:kontas-server,代码行数:13,代码来源:CategoryService.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Category $category)
 {
     $categoriesObj = $category->all();
     $categoriesArr = $category->getCategoriesArr($categoriesObj);
     $parentChildArr = $this->categoryPAndCObj->getHierarchy();
     return view('categories.index', compact('categoriesObj', 'parentChildArr', 'categoriesArr'));
 }
开发者ID:nowarena,项目名称:homestead,代码行数:12,代码来源:CategoriesController.php

示例3: edit

 public function edit($id)
 {
     $category = Category::all();
     $product = Product::find($id);
     $imagepivot = $product->image_product()->where('product_id', $id)->get()->toArray();
     return view('admin.products.edit', compact('product', 'category', 'imagepivot'));
 }
开发者ID:sbrojdenov,项目名称:shop,代码行数:7,代码来源:ProductsController.php

示例4: all

 public function all()
 {
     $businesses = Business::all();
     $categories = Category::all();
     $page = "Toutes les entreprises";
     return view('businesses', compact('businesses', 'page', 'categories'));
 }
开发者ID:francoislevesque,项目名称:lavalpme,代码行数:7,代码来源:PageController.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Category $category)
 {
     //
     $blogs = $category->blogs()->paginate(5);
     $categories = Category::all();
     return view('categories.show', compact('blogs', 'category', 'categories'));
 }
开发者ID:swantrace,项目名称:laravelblog,代码行数:13,代码来源:CategoriesController.php

示例6: index

 /**
  * Index page
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $productsCount = Product::all()->count();
     $categoriesCount = Category::all()->count();
     $usersCount = User::all()->count();
     return view('manage.index', compact('productsCount', 'categoriesCount', 'usersCount'));
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:12,代码来源:ManageController.php

示例7: edit

 public function edit($id)
 {
     $post = Post::whereId($id)->FirstOrFail();
     $categories = Category::all();
     $selectedCategories = $post->categories->lists('id')->toArray();
     return view('backend.posts.edit', compact('post', 'categories', 'selectedCategories'));
 }
开发者ID:corean,项目名称:LearningLaravel,代码行数:7,代码来源:PostsController.php

示例8: __construct

 public function __construct()
 {
     // injecter du code dans une vue, $view <-> au template
     View::composer('partials.main_menu', function ($view) {
         $view->with('categories', Category::all());
     });
 }
开发者ID:julesnicolas,项目名称:student,代码行数:7,代码来源:Controller.php

示例9: getAllFromCache

 public static function getAllFromCache()
 {
     $categories = Cache::rememberForever('categories', function () {
         return Category::all();
     });
     return $categories;
 }
开发者ID:mikolajszczepanski,项目名称:NuPtr,代码行数:7,代码来源:Category.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Category::all()->count() > 0) {
         return $next($request);
     }
     return redirect()->route('courses.index')->withErrors(['message' => 'No existen categor&iacuteas registradas.']);
 }
开发者ID:Kenneth058,项目名称:adminclubinnova,代码行数:14,代码来源:CategoryNotEmptyMid.php

示例11: edit

 public function edit($id)
 {
     $product = Product::find($id);
     $tags = Tag::lists('name', 'id');
     $categories = Category::all();
     return view('admin.edit', compact('product', 'tags', 'categories'));
 }
开发者ID:jbcharrier,项目名称:Projet-Ecole-Multimedia-StarWars-Store,代码行数:7,代码来源:ProductController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $category = Category::all();
     return $category;
     //  return dd($products); //remove later
     //return response()->json(['categories'=>$categories]);
 }
开发者ID:ShehabSunny,项目名称:ProductZap,代码行数:12,代码来源:CategoryController.php

示例13: edit

 public function edit($id)
 {
     $displays = $displayss = Display::all();
     $categorys = $categoryss = Category::all();
     $article = Article::find($id);
     return view('admin.articles.edit', ['article' => $article, "categorys" => $categorys, "categoryss" => $categoryss, "displays" => $displays, "displayss" => $displayss]);
 }
开发者ID:goyuquan,项目名称:tjsj,代码行数:7,代码来源:ArticleController.php

示例14: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $pageTitle = 'Add New Article';
     // Administrator
     if (Auth::user()->hasRole(['administrator'])) {
         $categories = Category::all();
     }
     // Department Manager
     if (Auth::user()->hasRole(['department_manager'])) {
         $department = Auth::user()->departments->first();
         $categories = Category::where('department_id', '=', $department->id)->get();
     }
     // Category Manager
     if (Auth::user()->hasRole(['category_manager'])) {
         $categories = Category::where('manager', '=', Auth::user()->id);
     }
     // Article Manager
     // Who can write for all categories of department which is allocated.
     // Currently, article managers are separately with category managers
     if (Auth::user()->hasRole(['article_manager'])) {
         $department = Auth::user()->departments->first();
         $categories = Category::where('department_id', '=', $department->id)->get();
     }
     return view('home.articles.create', compact('pageTitle', 'categories'));
 }
开发者ID:RenQilei,项目名称:finalProject,代码行数:30,代码来源:ArticleController.php

示例15: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $formats = Format::all();
     $categories = Category::all();
     $output = array('formats' => $formats, 'categories' => $categories);
     return view('user.addBook', compact('output'));
 }
开发者ID:EmilAleksandrov,项目名称:book-library-laravel,代码行数:12,代码来源:BookController.php


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