本文整理汇总了PHP中app\models\Product::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::select方法的具体用法?PHP Product::select怎么用?PHP Product::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Product
的用法示例。
在下文中一共展示了Product::select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
# returns a list of products in decreasing order by date created
$products = Product::select('*')->orderBy('created_at', 'desc')->paginate(5);
return view('skins/skin_b/product/index', ['products' => $products]);
# return response()->json( Product::all() );
}
示例2: postDetail
public function postDetail()
{
$return['success'] = 0;
if (Input::has('id')) {
$product = Product::select('name_en', 'name_id', 'price', 'masked_price', 'promo_label_en', 'promo_label_id', 'image', 'type', 'created_at as cdate')->find(Input::get('id'));
if ($product !== null) {
$return['success'] = 1;
$data['name_en'] = $product->name_en;
$data['name_id'] = $product->name_id;
$data['price'] = $product->price;
$data['image'] = $product->image;
$data['type'] = $product->type;
$data['promo_label_en'] = $product->promo_label_en;
$data['promo_label_id'] = $product->promo_label_id;
$data['masked_price'] = $product->masked_price;
$data['created_at'] = $product->cdate;
$return['data'] = $data;
}
}
echo json_encode($return);
}
示例3: ajaxProduct_enable
public function ajaxProduct_enable(Request $request)
{
$feedId = Input::get('feedid');
$products = Product::select(array('products.id', 'products.name', 'products.description', 'products.image'))->where('feed_id', Input::get('feedid'));
return Datatables::of($products)->addColumn('active', function ($products) {
return '<input type="checkbox" name="disable[]" value="' . $products->id . '">';
}, 0)->editColumn('image', '<img src="{!! $image !!}" height="50" width="50">')->make();
}
示例4: getProductsByFullText
public function getProductsByFullText($rawQuery, $fields, $orderBy, $paginate = false, $pageSize = 25)
{
$arrTerms = $this->prepareFullTextSearchQuery($rawQuery);
$terms = implode(' ', $arrTerms);
$query = "MATCH (name, description, gtin, mpc, brand, ingredient_deck) AGAINST ('{$terms}' IN BOOLEAN MODE)";
if ($paginate) {
$products = Product::select($fields)->whereRaw($query)->orderBy($orderBy)->paginate($pageSize);
} else {
$products = Product::select($fields)->whereRaw($query)->orderBy($orderBy)->get();
}
return $products;
}