Product::where('category_id', 5)->get();
The answer will be even more confusing: it depends on Laravel version.
You see, the change was made in Laravel 5.3.
Up until 5.2, where() meant "identical" comparison. And if you wanted to use "equal" operator, there was a special function whereLoose().
From Laravel 5.3, it's the other way around: default where() means "equal" or "loose" comparison, and if you want do perform "strict" comparison - you can use whereStrict() function.
If you want to read more, here's the link to the official 5.3 documentation.
Enjoyed This Tutorial?
Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.
Recent Courses
[NEW] Next.js Basics for Laravel Developers
11 lessons
58 min
How to Build Laravel 13 API From Scratch
30 lessons
1 h 23 min
[FREE] Laravel 13 for Beginners: 3 Demo Projects
5 lessons
29 min
Comments & Discussion
No comments yet…