I believe it's only done for displaying purposes. As far as I can see in the code no integers are converted to strings when building the query. The only thing I can think of is that you are casting the ID by yourself as another type in your model, but it sounds you are not doing that right now.
Nov 22, 2017
6
Level 1
Eloquent is running queries as 'strings' instead of Ints
I'm using the Debugbar to view my queries run on the page.
https://www.screencast.com/t/K5gz6aGJ4u
With that tool, I'm seeing that it queries the database using strings instead of ints. Am I reading this correctly?
Since my data type is an int, I want it to query as an int to speed up the performance.
Level 88
@rodrigo.pedra Is right. In this case the database return strings here. I checked it locally with a Homestead box and I'm gettings strings as well.
I tried the casting thing and on a database with a million records I didn't see any performance differences.
1 like
Please or to participate in this conversation.