Skip to content

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

Closed
@UnrulyNatives

Description

@UnrulyNatives

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions