-2
我有班級名單和職位,他們有關係belongsToMany
與數據透視表。如何在laravel關係中使用orderBy()?
1)名單:
id
name
type_order //1- sort post by rating, 2 - by id, 3 - by random
2)職位:
id
text
3)list_post
id
list_id
post_id
如何實現sortBy與參數(type_order)當我告訴feeds
與關係post
? 也許usign範圍?
我使用Feed控制器並從show($ feed)我得到哪個帖子屬於feed。 – crewmoeed32
所以你說你有Feed模型和Post屬於Feed。對? –
是的,我的請求看起來像這樣:http:// localhost/list/1?fields = posts。* – crewmoeed32