check if FindFirst is empty

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

With normal find it's easy: ```php $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 ```php $meeting = Meetings::findFirst($id); if(count($meeting) !== 1) { // <--- THIS IS ALWAYS 1 $this->flash->error("Couldn't find your meeting. What's up?"); } ```



83.2k

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?");
}


9.4k

Ach, thanks. That's a great tip!