本文整理汇总了PHP中app\models\Product::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getAll方法的具体用法?PHP Product::getAll怎么用?PHP Product::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::getAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detail
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function detail($slug)
{
$explodeSlug = explode('-', $slug);
$product_id = explode('.', end($explodeSlug))[0];
if (!$product_id) {
return View::make('errors/503');
}
$model = new Product();
$product = $model->getAll()->where('id', $product_id)->first();
if (empty($product)) {
return View::make('errors/503');
}
$relatedProduct = $model->getAll()->where('category_id', $product->category_id)->get();
$data = ["title" => $product ? $product->name : '', 'product' => $product, 'keywords' => $product ? $product->keywords : '', "description" => $product ? $product->description : '', 'releated_product' => $relatedProduct];
return View::make('user/detail_product', $data);
}
示例2: getShow
public function getShow(Request $request)
{
$categoryId = $request->categoryId;
$providerId = $request->providerId;
$Model = new Product();
$total = $Model->getAll()->count();
$Model = $Model->getAll()->orderBy('id', 'DESC');
if ($categoryId) {
$total = $Model->where('category_id', $categoryId)->count();
}
if ($providerId) {
$total = $Model->where('provider_id', $providerId)->count();
}
$datas = $this->paging($Model, $request);
$arrTotal = ['total' => $total];
return $this->ResponseData($datas, $arrTotal);
}
示例3: actionIndex
public function actionIndex()
{
$products = Product::getAll();
return $this->render('index', ['products' => $products]);
}
示例4: actionAll
public function actionAll()
{
$modelProduct = new Product();
$allProducts = $modelProduct->getAll();
return $this->render('all', ['allProducts' => $allProducts]);
}