check if FindFirst is empty

What's the correct way to check if findFirst actually found a result?

With normal find it's easy:

$meeting = Meetings::find($id);
if(count($meeting) !== 1) {
        $this->flash->error("Couldn't find your meeting. What's up?");
}  

But when using findFirst, count always returns 1

$meeting = Meetings::findFirst($id);
if(count($meeting) !== 1) { // <--- THIS IS ALWAYS 1
        $this->flash->error("Couldn't find your meeting. What's up?");
} 


90.1k

findFirst returns false if it didn't find any record, just do this:

$meeting = Meetings::findFirst($id);
if (!$meeting) {
        $this->flash->error("Couldn't find your meeting. What's up?");
} 


11.7k

Ach, thanks. That's a great tip!