I\'m getting the following error
(1/1) ErrorException
compact(): Undefined variable: operator
This is my line of code
$pos
Please refer to this https://github.com/laravel/framework/issues/26936
The version of Laravel would need to be updated.
Go to your project in vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php
In line number 1337, you can found below code inside the addWhereExistsQuery method
$this->wheres[] = compact('type', 'operator', 'query', 'boolean');
you just remove the 'operator' paramiter
and I hope it will work fine
If you are not able to upgrade your Laravel, you just could change your Query to RAW query, it worked for me.
Instead of passing the variable to the compact()
method, you'll passe it the name of the variable as a string without the dollar symbol.
$postsCats = Post::all(); // example
return view('posts.index', compact('postsCats'));