本文整理汇总了PHP中Food::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Food::where方法的具体用法?PHP Food::where怎么用?PHP Food::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Food
的用法示例。
在下文中一共展示了Food::where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_get
public function edit_get($id)
{
$this->_data['data'] = Food::where("food_id", $id)->first();
return View::make("admin.content.food.edit", $this->_data)->with("titlePage", "Edit Food")->with("titleTable", "Sửa món ăn tại nhà hàng");
}
示例2: function
// 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();
if ($food) {
$food->user = $food->profile();
return $response->write(json_encode($food) . ' ');
}
return $response->write('{"msg": "ERR"}');
})->setName('food_detail');
// yemeğe yapılan yorumlar
$this->get('/{id:[0-9]+}/comments/{page:[0-9]+}', function ($request, $response, $args) {
$comments = Comment::where('food_id', $args['id'])->where('deleted', 0)->take(10)->offset($args['page'] * 10)->orderBy('comment_id', 'DESC')->get();
return $response->write(json_encode($comments) . ' ');
})->setName('food_comments');
// yemek ekle
$this->post('', function ($request, $response, $args) {
示例3: foods
/**
*
* @param $typing
* @return mixed
*/
private function foods($typing)
{
$foods = Food::where('user_id', Auth::user()->id)->where('name', 'LIKE', $typing)->with('defaultUnit')->with('units')->get();
return $foods;
}