0
votes

I got problem Method Illuminate\Database\Eloquent\Collection::orWhere does not exist. I just wanna use orWhere on that case

I tried adding ->get() in the last query but it still error

$category = Auth::user()->division->allCode->where('parent', '0')->where('info_code', 'code_h')
            ->orWhere('info_code','=', 'code_m')->where('parent', '0');

I want to use or where in this case and get the result. here the logic I want

(parent==0 && info_code == code_h) || (parent==0 && info_code == code_m)
1

1 Answers

3
votes

Use () after allCode like: Auth::user()->division->allCode()->where...