Laravel Eloquent-将多个查询合并为一个列表

时间:2019-09-30 13:59:29

标签: mysql laravel eloquent model lumen

如果可行:

$offer::(‘Information’)->prices()->personal(1)->max(‘price’);

这可行:

$offer::(‘Information’)->prices()->personal(1)->min(‘price’);

没有办法以某种方式将它们组合起来,例如:

$offer::(‘Information’)->prices()->personal(1)->max(‘price’)->as('max_personal_price')->prices()->personal(1)->min(‘price’)->as('min_personal_price');

只需要调用一个查询就可以获取所有可用信息:

{
     "id": 1,
     "name": "test",
     "max_personal_price": 1234.50,
     "min_personal_price": 345.40,
     "information": {
         "type": 3,
         "status": 1
     }
}

0 个答案:

没有答案