what am i doing wrong guys ?
i'm trying to retrieve a customer list from the specific company that the user is registered
so i got the logged user and catched the company that he works for
@php
$stage = 1;
$company_user= Auth::user()->company;;
$related_users= $users->where('company', $company_user);
@endphp
then i'm trying to use a foreach to receive the customers from that specific company
@foreach ($customers->where('stage', $stage)->whereIn('user_registered', $related_users) as $customer)
@endforeach
i've tried also but no success
@foreach
($customers->where('stage', $stage)->whereIn('user_registered', $related_users()->id) as $customer)
@endforeach
tried also but no success
@foreach
($customers->where('stage', $stage)->whereIn('user_registered', array($related_users)) as $customer)
@endforeach
i think its just a code writting problem.. because i'm getting an object instead of a array..
all the variables are getting their values.. so i guess just the wherein clause is wrong...
can someone help? i think its a easy problem.. i'm new to laravel