Why when I pass false to Model::where() and then trying to get first() element it always returns me first element instead of null?
Example:
I have Referrer model with hash_id = 123aSd456fGh
and I try to get this like below:
$requestReferrer = false;
$referrer = Referrer::where('hash_id', $requestReferrer)->first();
dd($referrer); // returns first Referrer model with hash_id = 123aSd456fGh
FYI
when I pass null in exchange for false it returns null.
Referrer?nullwould be most suitable for this use case? Then you can do->whereNull('hash_id').