public function index()
{
$userbio = (Auth::user()->biometrics);
if (Auth::user()->hasRole('User')) {
$attendances = Attendance::latest()->orderBy('date')->paginate(30)->where('biometrics', '=', $userbio);
return view('attendances.index',compact('attendances'))
->with('i', (request()->input('page', 1) - 1) * 5);
};
}嗨,专家们!我只想问为什么我不存在方法链接的错误。当我把“where(‘生物特征’,'=',$userbio);”放在“where”时,是。我正在添加它,以便它将显示的数据仅是等于$userbio的字段。
发布于 2018-04-03 09:19:01
您需要将where子句放在分页调用之前。
试着这样做:
$attendances = Attendance::latest()
->orderBy('date')
->where('biometrics', $userbio)
->paginate(30);https://stackoverflow.com/questions/49626108
复制相似问题