This may be a trivial question but I am wondering if Laravel recommends a certain way to check whether an Eloquent collection returned from $result = Model::where(...)->get()
is empty, as well as counting the number of elements.
We are currently using !$result
to detect empty result, is that sufficient? As for count($result)
, does it actually cover all cases, including empty result?