No*.
* unless you choose to cache all username/password as key/value pairs
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys; Do you guys know how to Get UserId with UserName without query?
The regular way with query in the controller file
public function testing($name)
{
$userId = User::where('name', $name)->first()->id;
}
is there any better way to get the id without the query? Thanks
No*.
* unless you choose to cache all username/password as key/value pairs
Please or to participate in this conversation.