You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using NestableTrait in my model. I want to use where to select some of the rows. My model is Category Category::where('name', "Clothes"); works fine. But if I want to use it like this: Category::where('name', 'LIKE', "%Clothes%"); it doesn't have any items in it.
When I use a raw query to get the columns it has some items in it: collect(DB::select("SELECT * FROM categoriesWHEREname LIKE '%clothes%';"));
Any idea how I can fix this? I would have used the raw query but I want the model's relations as well, and it doesn't make any sense to add the relations by join when I can simply use the model.
The text was updated successfully, but these errors were encountered:
I'm using NestableTrait in my model. I want to use where to select some of the rows. My model is
Category
Category::where('name', "Clothes");
works fine. But if I want to use it like this:Category::where('name', 'LIKE', "%Clothes%");
it doesn't have any items in it.When I use a raw query to get the columns it has some items in it:
collect(DB::select("SELECT * FROM
categoriesWHERE
nameLIKE '%clothes%';"));
Any idea how I can fix this? I would have used the raw query but I want the model's relations as well, and it doesn't make any sense to add the relations by
join
when I can simply use the model.The text was updated successfully, but these errors were encountered: