本文整理匯總了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'));
}