Level 104
find assumes the id column; all it does is alias a where statement anyway:
$user = DB::table('users')->where('CUSTOMID', 3)->first();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to set my custom primary key (CUSTOMID) when using the following Query Builder request ?
$user = DB::table('users')->find(3);
find assumes the id column; all it does is alias a where statement anyway:
$user = DB::table('users')->where('CUSTOMID', 3)->first();
Please or to participate in this conversation.