首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >方法链接不存在。

方法链接不存在。
EN

Stack Overflow用户
提问于 2018-04-03 09:03:27
回答 1查看 559关注 0票数 0
代码语言:javascript
复制
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的字段。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-03 09:19:01

您需要将where子句放在分页调用之前。

试着这样做:

代码语言:javascript
复制
$attendances = Attendance::latest()
    ->orderBy('date')
    ->where('biometrics', $userbio)
    ->paginate(30);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49626108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档