我正在开发一个 Laravel 项目,并尝试将此查询转换为一个雄辩的查询,以便我可以急切地加载其他关系。
$restaurants = DB::query('SELECT *, ( 3959 * acos( cos( radians(21.420639) ) * cos( radians( lat ) ) * cos( radians( lon ) - radians(-157.805745) ) + sin( radians(21.420639) ) * sin( radians( lat ) ) ) ) AS distance FROM restaurants GROUP BY id HAVING distance < 25 AND ratingsTotal > 0 ORDER BY distance LIMIT 0 , 5');
任何有关这应该如何看起来的帮助将不胜感激。