我经过查询后的分页为什么会出现报错?

public function select(Request $request)
{
$judges = Judge::when($request->name, function ($query) use ($request) {
return $query->where('name', 'like', '%'.$request->name.'%');
})->when($request->item, function ($query) use ($request) {
return $query->where('item', 'like', '%'.$request->item.'%');
})->when($request->is_free, function ($query) use ($request) {
return $query->where('is_free', 'like', '%'.$request->is_free.'%');
})->paginate(10);
return view('judges.index', compact('judges'));
}
这是我的代码 在显示index后 可以显示第一页,但是当点击第二页的时候就就报错了!
错在下面(抱歉不会发图片)
protected function methodNotAllowed(array $others)
{
throw new MethodNotAllowedHttpException($others);
}

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
你看我吊吗啊
最佳答案

按照经验 methodNotAllowed 应该是请求方式GET POST 上的对应错误,如果你检查一下这儿没问题,就在return里改一下 ,改成这样 试试 return view('judges.index', compact('judges',$judges));

6年前 评论
讨论数量: 2
你看我吊吗啊

按照经验 methodNotAllowed 应该是请求方式GET POST 上的对应错误,如果你检查一下这儿没问题,就在return里改一下 ,改成这样 试试 return view('judges.index', compact('judges',$judges));

6年前 评论
你看我吊吗啊

另外注意排版,看一下虚线框内的说明 至少遵循markdown

6年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!