我使用 ajax 创建了一个 laravel 聊天应用程序。但没有得到任何适当的聊天分页查询。我需要想法来做到这一点
$data['messages'] = Chat::where(function($q) use($id){
$q->where('from',auth()->user()->id);
$q->where('to',$id);
})->orWhere(function($q) use ($id){
$q->where('from',$id);
$q->where('to',auth()->user()->id);
})->with('user', 'userto')->get();
没有从谷歌得到任何代码。