laravel 方法链接不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41508037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:04:45  来源:igfitidea点击:

Method links does not exist

laravellaravel-5laravel-5.2

提问by None

Im getting this error when i do like this. I want that my search is case insensitive. Any suggestion?

当我这样做时,我收到此错误。我希望我的搜索不区分大小写。有什么建议吗?

  $articles = Articles::whereHas('translations',function($query) use($search){
    $query->whereRaw('LOWER(`title`) like ?', array( $search))
    ->orWhereRaw('LOWER(`intro`) like ?', array( $search))
    ->orWhereRaw('LOWER(`content`) like ?', array( $search));
  })->get();

回答by Alexey Mezenin

As @dev said you can get this error only when you're using links()method. What you need to do is:

正如@dev 所说,只有在使用links()方法时才会出现此错误。你需要做的是:

  1. Use paginate(10)instead of get()
  2. Use render()instead of links()as latter was deprecated.
  1. 使用paginate(10)代替get()
  2. 不推荐使用render()而不是links()作为后者。