Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withPivot with '!=' as operator would throw 'Illegal operator` error #13314

Closed
UnrulyNatives opened this issue Apr 26, 2016 · 0 comments
Closed

Comments

@UnrulyNatives
Copy link

UnrulyNatives commented Apr 26, 2016

As described in detail here:
http://stackoverflow.com/questions/36856090/counting-models-related-through-manytomany-only-if-a-pivot-attribute-null-lara

The wherePivot would not accept '!=' operator.

This code produces a collection:

`public function activities()
{

return $this->belongsToMany('App\Models\Activity')->withPivot('done_at')->wherePivot('done_at','=',null);
}`

while this

`public function activitiesOnlyDone()
{

return $this->belongsToMany('App\Models\Activity')->withPivot('done_at')->wherePivot('done_at','!=',null);
}`

throws Illegal operator error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant