Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Th3apprenTis's avatar

Database query on every view

My app doesn't have authentication but still i see the following query being executed on every view when debugging with Clockwork

SELECT * FROM `users` WHERE `id` = '1' LIMIT 1

Any idea where that query is coming from.I suppose it may be a laravel middleware

0 likes
4 replies
a4ashraf's avatar

@th3apprentis

which Laravel version are you using?

here are maybe reasons

  • check your Kernel.php, maybe use any auth middleware
  • check your Auth and App Provider
  • check your controller file maybe you include any auth class
  • check your model file

if you share some code that would be great

Snapey's avatar

every view or every request ?

Any view composers?

Snapey's avatar

it's loading the current user and is part of starting sessions in the web middleware

You say you have a user ... then you need it, otherwise they would be a guest

Please or to participate in this conversation.