Closed TeRMiNaTe closed 5 years ago
Since version 2.3, wherehas returns an error when using a query like this:
$account->brands()->whereHas('user', function ($query) use ($user) { $query->where('users.id', $user->id); })->first();
the error itself:
'BadMethodCallException' with message 'Call to undefined method Illuminate\Database\Query\Builder::getHasCompareKey()' in /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2405 Stack trace: #0 [internal function]: Illuminate\Database\Query\Builder->__call('getHasCompareKe...', Array) #1 [internal function]: Illuminate\Database\Query\Builder->getHasCompareKey() #2 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1426): call_user_func_array(Array, Array) #3 [internal function]: Illuminate\Database\Eloquent\Builder->__call('getHasCompareKe...', Array) #4 [internal function]: Illuminate\Database\Eloquent\Builder->getHasCompareKey() #5 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php(343): call_user_func_array(Array, Array) #6 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php(165): Illuminate\Database\Eloquent\Relations\Relation->__call('getHasCompareKe...', Array) #7 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php(165): Znck\Eloquent\Relations\BelongsToThrough->getHasCompareKey() #8 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(823): Illuminate\Database\Eloquent\Relations\Relation->getRelationQuery(Object(Illuminate\Database\Eloquent\Builder), Object(Illuminate\Database\Eloquent\Builder)) #9 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(886): Illuminate\Database\Eloquent\Builder->has('user', '>=', 1, 'and', Object(Closure)) #10 [internal function]: Illuminate\Database\Eloquent\Builder->whereHas('user', Object(Closure)) #11 /home/digitaloctoapp/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php(343): call_user_func_array(Array, Array) #12 /home/digitaloctoapp/public_html/app/Console/Commands/AccountSummary.php(178): Illuminate\Database\Eloquent\Relations\Relation->__call('whereHas', Array) #13 /home/digitaloctoapp/public_html/app/Console/Commands/AccountSummary.php(178): Illuminate\Database\Eloquent\Relations\BelongsToMany->whereHas('user', Object(Closure)) #14 [internal function]: App\Console\Commands\AccountSummary->handle()
Reverted back to 2.2.2 and everything works as expected
This bug is not fixed?
This has been fixed in the latest release.
Since version 2.3, wherehas returns an error when using a query like this:
the error itself:
Reverted back to 2.2.2 and everything works as expected