- 
  Notifications
 You must be signed in to change notification settings 
- Fork 1.4k
I'm having issues with where condition can anyone help ? #2698
 
 Unanswered
 
 
 
 
 piyushpathar
 
 
 
 asked this question in
 Q&A
 
 -
I'm having issues with the Eloquent query for my Subscription model. The following code is not returning the expected results:
$id = $request->id;
$companyId = User::find($id)->company->id;
$subscription = Subscription::where('companyId', $companyId)->get();
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Do you have the same type for $companyId and the companyId field in the document stored in MongoDB?
Perhaps you should cast the id into string.
$subscription = Subscription::where('companyId', (string) $companyId)->get();
Beta Was this translation helpful? Give feedback.
All reactions
 
 0 replies
 
 
 
 
 Sign up for free
 to join this conversation on GitHub.
 Already have an account?
 Sign in to comment