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


PHP Category::all方法代码示例

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


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

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $place = Place::with(['city', 'category'])->whereId($id)->first();
     $categories = Category::all();
     $cities = City::all();
     return view('client.placeinfo', compact('place', 'categories', 'cities'));
 }
开发者ID:rodiaa,项目名称:trpo,代码行数:13,代码来源:PlaceController.php

示例2: show

 public function show($id)
 {
     $id = intval($id);
     $articleInstance = Article::findOrFail($id);
     $categories = Category::all();
     return view('admin.detail')->withArticle($articleInstance)->withCategories($categories)->withId($id);
 }
开发者ID:Albertao,项目名称:myblog,代码行数:7,代码来源:ArticleAdminController.php

示例3: compose

 /**
  * Compose the view.
  *
  * @return void
  */
 public function compose(View $view)
 {
     $value = Cache::remember('users', 3, function () {
         return DB::table('users')->get();
     });
     $view->with('tags', Tags::all())->with('categories', Category::all());
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:12,代码来源:LeftAsideComposer.php

示例4: items

 public function items()
 {
     $pages_categories = Category::all();
     $publication_categories = PublicationCategory::all();
     $modules = ['tenders', 'trainings', 'news', 'faqs', 'videos', 'galleries'];
     return view('menuitems.items', compact('pages_categories', 'publication_categories', 'modules'));
 }
开发者ID:danielchikaka,项目名称:osh,代码行数:7,代码来源:MenuItemsController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $category = Category::all();
     $blog = Blog::all();
     $images = Auth::user()->getPhoto();
     return view('beranda.home', ['images' => $images])->with('blog', $blog);
 }
开发者ID:aririfani,项目名称:socialblog,代码行数:12,代码来源:BerandaController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $brand = Brand::all();
     $category = Category::all();
     $user = User::all();
     return view('product.create_new_product', compact('brand', 'category', 'subcat_level1', 'user'));
 }
开发者ID:khakanali,项目名称:OpenMAll,代码行数:12,代码来源:ProductController.php

示例7: getEdit

 public function getEdit($id)
 {
     $categories = [];
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return view('admin.products.details', ['product' => Product::find($id), 'categories' => $categories]);
 }
开发者ID:venomir,项目名称:tc,代码行数:8,代码来源:ProductController.php

示例8: all

 public function all()
 {
     $categories = Category::all();
     if ($categories->isEmpty()) {
         return $this->responseNotFound(['Categories is empty']);
     }
     $categories = $this->parseCategories($categories);
     return $this->responseOk($categories);
 }
开发者ID:restoko,项目名称:restoko-api,代码行数:9,代码来源:CategoriesController.php

示例9: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $groupOption = "food";
     $menuOption = "dishes";
     $categories = Category::all();
     $dish = Dish::find($id);
     $selectedCategories = $dish->categories()->get();
     return view('backend.pages.food.editDish')->with(compact('categories', 'dish', 'selectedCategories', 'menuOption', 'groupOption'));
 }
开发者ID:adrianturnes,项目名称:menorcagastronomic,代码行数:15,代码来源:DishesController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $projects = Project::all()->sortByDesc('created_at');
     $categories = Category::all()->sortBy('name');
     //$user = JWTAuth::toUser(JWTAuth::getToken());
     $user = Auth::User();
     //dd($request->all());
     dd($user);
 }
开发者ID:alexjoverm,项目名称:Portfolio,代码行数:14,代码来源:DashboardController.php

示例11: getCategoryFilter

 public function getCategoryFilter($id)
 {
     $child_categories = [];
     foreach (Category::all() as $category) {
         if ($category->parent_id == $id) {
             $child_categories[] = $category->id;
         }
     }
     return view('products.index', ['products' => Product::whereIn('category_id', Category::find($id)->all_children())->get(), 'category' => Category::find($id), 'child_categories' => Category::whereIn('id', $child_categories)->get()]);
 }
开发者ID:venomir,项目名称:tc,代码行数:10,代码来源:ProductController.php

示例12: select

 public function select()
 {
     $category = Category::all();
     $itemType = ItemType::all();
     $data = [];
     foreach ($this->fields as $field => $default) {
         $data[$field] = old($field, $default);
     }
     return view("admin.item.select", ['category' => $category, 'itemType' => $itemType, 'data' => $data]);
 }
开发者ID:cdandy,项目名称:meta-admin,代码行数:10,代码来源:ItemController1.php

示例13: detail

 public function detail($slag)
 {
     $article = Article::where('slag', $slag)->findOrFail();
     if (!Article::find($article->id + 1)) {
         $article->max = true;
     } else {
         $article->max = false;
     }
     $categories = Category::all();
     return view('article.detail')->withArticle($article)->withCategories($categories)->withId($id);
 }
开发者ID:Albertao,项目名称:myblog,代码行数:11,代码来源:ArticleController.php

示例14: category

 public static function category()
 {
     $return = null;
     $category = Category::all();
     if (count($category)) {
         foreach ($category as $val) {
             $return[$val['cid']] = $val['name'];
         }
     }
     return $return;
 }
开发者ID:Crocodile26,项目名称:php-1,代码行数:11,代码来源:BlogController.php

示例15: get_add_sub_category

 public function get_add_sub_category(Category $category)
 {
     if (!$this->bool_has_role) {
         return $this->roleHelper->call_redirect();
     } else {
         $arr_categories_raw = $category->all()->toArray();
         $arr_categories_processed = $category->process_categories($arr_categories_raw);
         $data = array('arr_logged_in_user' => $this->arr_logged_in_user, 'arr_categories_processed' => $arr_categories_processed);
         return view('test_preparer/add_sub_category')->with('data', $data);
     }
 }
开发者ID:jenniferbradley49,项目名称:testing_app_two,代码行数:11,代码来源:TestPreparerController.php


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