我试着用Laravel雄辩来做一个复杂的查询。我知道如何使用原始SQL查询来完成它,但是我不知道如何使用雄辩的方法来完成它。下面是我的SQL查询,它工作得很好:from students from (select student_movements.id因此,我的问题是:如何将SQL查询翻译成雄辩?我看到了许多类似的问题,但它们对我没有帮助。
谢谢你的建议。
我想知道基于特定Post中的Like计数的Edition的等级。an edition// The id of the post to retrieve rank// Compose the query$query = App\Models\Post::where('edition_id', $edition_id)
// ... with like count (this produ