Answers for "how to check if eloquent qurey result is empty"

PHP
7

laravel check if laravel query is empty

if ($result->first()) { } 
if (!$result->isEmpty()) { }
if ($result->count()) { }
if (count($result)) { }
Posted by: Guest on May-18-2020
1

how to check if eloquent result is empty

Note:- Credit for this result goes to Alberto Peripolli. Copied from his Grepper.
if ($result->first()) { } 
if (!$result->isEmpty()) { }
if ($result->count()) { }
if (count($result)) { }
Posted by: Guest on September-05-2020

Code answers related to "how to check if eloquent qurey result is empty"

Browse Popular Code Answers by Language