本文整理汇总了PHP中Recipe::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Recipe::select方法的具体用法?PHP Recipe::select怎么用?PHP Recipe::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Recipe
的用法示例。
在下文中一共展示了Recipe::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexByProduct
public function indexByProduct($productSlug)
{
$product = Product::live()->where('slug', '=', $productSlug)->first();
if (!$product) {
\App::abort(404);
}
$recipes = Recipe::select('fbf_food_recipes.*')->join('fbf_food_product_recipe', 'fbf_food_recipes.id', '=', 'fbf_food_product_recipe.recipe_id')->join('fbf_food_products', 'fbf_food_product_recipe.product_id', '=', 'fbf_food_products.id')->where('fbf_food_products.slug', '=', $productSlug)->live()->orderBy('fbf_food_recipes.name')->paginate();
return \View::make(\Config::get('laravel-food::views.recipes.index'))->with(compact('product', 'recipes'));
}
示例2: getResults
private function getResults($separator)
{
$where = array();
$bindings = array();
foreach ($this->filters as $key => $value) {
$operator = strpos($value, '%') !== false ? 'LIKE' : '=';
$where[] = $key . ' ' . $operator . ' :' . $key;
$bindings[$key] = $value;
}
if (!empty($where)) {
$sql = 'SELECT * FROM recipe WHERE 1 AND (' . implode(' ' . $separator . ' ', $where) . ')';
$this->results = Recipe::select($sql, $bindings);
$this->count = count($this->results);
}
return $this;
}
示例3: RAND
<?php
require_once 'config/config.conf.php';
//$random_recipes = Recipe::getList('*', '', array(), 'RAND()', 3);
$random_recipes = Recipe::select('SELECT * FROM recipe ORDER BY RAND() LIMIT 3');
$vars = array('random_recipes' => $random_recipes);
Model::displayTemplate('index.tpl', $vars);