compact():未定义变量:运算符 [英] compact(): Undefined variable: operator

查看:104
本文介绍了compact():未定义变量:运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误

  (1/1) ErrorException
  compact(): Undefined variable: operator

这是我的代码行

$postsCat = Post::whereHas('Cat', function($query) use ($sreachWord) {
    return $query->whereRaw('name REGEXP"'.sql_text_to_regx($sreachWord).'"');
})->orderBy('top','desc')
->orderBy('updated_at','desc')
->paginate(30);

为什么会这样?是因为我的PHP版本(7.3)还是其他原因?

Why is this happening? Is it because of my PHP version (7.3) or something else?

推荐答案

转到您的项目,

vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php

在1337行上,您可以在 addWhereExistsQuery 方法

On line number 1337, you can found below code inside the addWhereExistsQuery method

$this->wheres[] = compact('type', 'operator', 'query', 'boolean');

您只需删除"operator"参数即可.

You just remove the 'operator' parameter.

我希望它能正常工作.

这篇关于compact():未定义变量:运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆