rtconner / laravel-tagging

Tag support for Laravel Eloquent models - Taggable Trait
MIT License
882 stars 168 forks source link

withAnyTag returns SQLSTATE[42S22] #27

Closed missbossy closed 9 years ago

missbossy commented 9 years ago

The tagging and untagging functions work fine. However both withAnyTag and withAllTags generate a database error.

I am calling this from the controller:

Item::withAnyTag('Something')->get();

Which returns:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'has' in 'where clause' (SQL: select * from items where has = ?) (Bindings: array ( 0 => 'tagged', ))

The tagging_tagged table is populated:

id taggable_id taggable_type tag_name tag_slug
1 20 Item Something something

I'd appreciate any suggestions you have for getting this to work. Thanks.

rtconner commented 9 years ago

What version of Laravel are you using?

missbossy commented 9 years ago

4.0.11

rtconner commented 9 years ago

Looks like the whereHas() method was added in 4.1. You'll have to either upgrade your Laravel version to 4.1 .. or not use this library. Sorry.

missbossy commented 9 years ago

Aha. OK thanks for the speedy reply.