1
這是我的查詢。設置限制爲雄辯關係
$helpCategoryList = HelpCategory::where('is_active', 1)
->with(['helps' => function($query) {
$query->with(['users'])
->withcount(['helpComments','helpResponse','helpVotes'])
->limit(5);}])
->orderBy('created_at', 'asc')
->get()
->toArray();
它從幫助表中給出了5條記錄,但我需要每個類別5條記錄的幫助細節。 所以每個類別都有很多幫助。