where needs two parameters, and you have only one. Use whereRaw instead.
Thx, never though that this would be the issue. So one var in the ->where results in is null.
where() method is used in the form
where($column, $operator, $value), so for example
where('reputation', '>', 10). If you're using the equals operator, you can just provide two arguments, e.g.
Looking at the API for the method: https://github.com/laravel/framework/blob/4.2/src/Illuminate/D..., if you just provide column, the operator and value default to null. Further down in the method, there's a check to see if the value is null and converts the query into a proper "is null" condition (since using "field = null" won't work), so that seems consistent with the behaviour you are seeing.
So, as above, use
whereRaw() since you want to perform a raw where query specific to the DBMS you're using, rather than the abstracted query builder.
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us
The Laravel portal for problem solving, knowledge sharing and community building.