How to cast ObjectId in Model, instead in where condition #2752
Unanswered
masterbater
asked this question in
Q&A
Replies: 1 comment 2 replies
-
It's working fine for me. $stringId = (string) (new ObjectId());
Client::query()->create(['cclient_id' => $stringId, 'name' => 'Young Gerald']);
Client::query()->where('cclient_id', $stringId)->first(); What version you are using? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is this correct? Its not working. but wrapping it
not working
this works
WorkoutLogs::where('ruleType', 'Vitals')->where('createdBy', new BSONObjectId('5be9ce7b3de6dd77db832950'))->orderBy('createdAt', 'desc')->paginate(10);
Beta Was this translation helpful? Give feedback.
All reactions