I'm getting the following error
(1/1) ErrorException
compact(): Undefined variable: operator
This is my line of code
$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);
Why is this happening? Is it because of my PHP version (7.3) or something else?
Go to your project in
vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php
On line number 1337, you can found below code inside the addWhereExistsQuery
method
$this->wheres[] = compact('type', 'operator', 'query', 'boolean');
You just remove the 'operator' parameter.
And I hope it will work fine.
Please refer to this https://github.com/laravel/framework/issues/26936
The version of Laravel would need to be updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With