Laravel Tip: Instead of using the ๐๐ต๐ฒ๐ฟ๐ฒ๐๐ป() method to load a large range of data when the targeted value is an integer, use ๐๐ต๐ฒ๐ฟ๐ฒ๐๐ป๐๐ฒ๐ด๐ฒ๐ฟ๐๐ป๐ฅ๐ฎ๐() which is faster than ๐๐ต๐ฒ๐ฟ๐ฒ๐๐ป().
Benchmark::measure([ fn() => User::whereIn('id', range(1,500))->get(), fn() => User::whereIntegerInRaw('id', range(1,500))->get() ], 3) Run 3 times. Result: 5.80 0.86 4.30 1.69 3.08 0.92