本文整理汇总了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'));
}
示例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);
}
示例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());
}
示例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'));
}
示例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);
}
示例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'));
}
示例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]);
}
示例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);
}
示例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'));
}
示例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);
}
示例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()]);
}
示例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]);
}
示例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);
}
示例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;
}
示例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);
}
}