mardi 12 mars 2019

Laravel Is it possible to improve Auth::id() query?

On Laravel, running any Auth function to retrieve the authenticated user Auth::user(), Auth::check() or Auth::id(), always generates the following query:

select * from `users` where `id` = 1 limit 1

This, in many cases could be more efficient since I just wanted to know if the user is authenticated.

By using Auth::id() the query should be at least optimized to select id from, instead of select * from.

Is there a way to avoid the query to be run or at least improve it?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JaGLDJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire