本文整理汇总了PHP中Food::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Food::select方法的具体用法?PHP Food::select怎么用?PHP Food::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Food
的用法示例。
在下文中一共展示了Food::select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Material
$newMaterial = new Material();
$newMaterial->name = $material;
$newMaterial->create_date = date("YmdHi");
$newMaterial->last_update_date = date("YmdHi");
$newMaterial->save();
}
}
$sqlStr = "*" . implode("* *", $materials) . "*";
// giri *domates* *tavuk* *malzeme* şeklindedir
// saklı yordam kullanılmıştır
$foods = Food::hydrateRaw("CALL searchRecipe(?)", array($sqlStr));
return $response->write(json_encode($foods) . " ");
})->setName('search_foods');
// sayfalı son yemekler
$this->get('/all/{page:[0-9]+}', function ($request, $response, $args) {
$food = Food::select('food_id', 'name', 'description')->where('deleted', 0)->take(6)->offset($args['page'] * 6)->orderBy('food_id', 'DESC')->get();
if ($food) {
return $response->write(json_encode($food) . ' ');
}
return $response->write('{"msg": "ERR"}');
})->setName('foods');
// sayfalı son yemekler
$this->get('/popular/{page:[0-9]+}', function ($request, $response, $args) {
$food = Food::take(6)->offset($args['page'] * 6)->orderBy('displayed', 'DESC')->get();
return $response->write(json_encode($food) . ' ');
})->setName('popular_foods');
// id'den yemek
$this->get('/{id:[0-9]+}', function ($request, $response, $args) {
$food = Food::where('food_id', $args['id'])->where('deleted', 0)->get()->first();
$food->displayed = $food->displayed + 1;
$food->save();