if (request()->has('since')) { // example.org/?since= // fails with illegal operator and value combination $query->whereDate('created_at', '<=', request('since'));} if (request()->input('name')) { // example.org/?name=0 // fails to apply query filter because evaluates to false $query->where('name', request('name'));} if (request()->filled('key')) { // correct way to check if get parameter has value}
Tip given by @mc0de
Enjoyed This Tip?
Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.
Recent Courses
Building a Typical Laravel SaaS
13 lessons
1 h 58 min
How to Build Laravel 12 API From Scratch
28 lessons
1 h 21 min
Filament 4 From Scratch
28 lessons
2 h 25 min