本文整理汇总了PHP中CodeCommerce\Category::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::find方法的具体用法?PHP Category::find怎么用?PHP Category::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeCommerce\Category
的用法示例。
在下文中一共展示了Category::find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: category
public function category($id)
{
$categories = $this->category->all();
$category = $this->category->find($id);
$products = $this->product->ofCategory($id)->get();
return view('store.category', compact('categories', 'category', 'products'));
}
示例2: category
public function category($id)
{
$categories = Category::all();
$category = Category::find($id);
$products = Product::ofCategory($id)->get();
return view('store.category', compact('categories', 'category', 'products'));
}
示例3: categoryScope
public function categoryScope($id, Category $cat, Product $prod)
{
$categories = $cat->all();
$category = $cat->find($id);
$products = $prod->ofCategory($id)->get();
return view('store.category', compact('categories', 'products', 'category'));
}
示例4: tag
public function tag($id)
{
$categories = Category::all();
$tag = Category::find($id);
$products = Product::ofTag($id)->get();
$name = 'Tag: ' . $tag->name;
return view('store.category', compact('categories', 'products', 'name'));
}
示例5: category
public function category($id)
{
$category = Category::find($id);
if ($category) {
$categories = Category::all();
$categorie_name = $category->name;
$products = Category::find($id)->products;
} else {
return redirect()->route('store.index');
}
return view('store.products', compact('categories', 'categorie_name', 'products'));
}
示例6: listProductsCategory
public function listProductsCategory($id)
{
$categories = $this->category->all();
$category = $this->category->find($id);
return view('store.products_categorie', compact('category', 'categories'));
}
示例7: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$this->category->find($id)->delete();
return redirect()->route('categories.index');
}
示例8: category
public function category($id)
{
$category = Category::find($id);
$categories = Category::all();
return view('store.categories', compact('categories', 'category'));
}
示例9: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$cateogy = $this->category->find($id);
return $cateogy->name;
}
示例10: listByCategory
public function listByCategory($id)
{
$category = Category::find($id);
return view('store.category', compact('category'));
}