Method orWhere does not exist. Laravel 5.3
12,114
You are trying to use orWhere
on collections, thats why its showing you the error. You should use this on model like this (taking Category
as a Model):
$category = Category::where('Node_ID', (explode('.', $cat{$title_id})[0]))
->orWhere('Node_Path', $cat->{$category_name})
->first();
See Laravel Docs for
orWhere()
Hope this helps!
Related videos on Youtube
Author by
Adrián Silvestre
By DAY: I Work at international/intercultural company in Germany offering services like to sell on different marketplaces. By NIGHT: Curious and new technologies addicted, looking for the way to improve myself. I Like: Dogs, green parks, BBQ's, Sports, learn new languages, and Travel. I don't like: Complains, Boredom, and Lazy people.
Updated on September 15, 2022Comments
-
Adrián Silvestre over 1 year
BadMethodCallException in Macroable.php line 74: Method orWhere does not exist.
$category = $categories->where('Node_ID', (explode('.', $cat{$title_id})[0])) ->orWhere('Node_Path', $cat->{$category_name}) ->first();
If I try without "orWhere" works, if I use it, throws an Error. Someone knows where is the mistake?