How to check if an item exists in Laravel Eloquent collection without counting
Categorized as Laravel
Hello friends! You can check if an item exists or not using Laravel Eloquent with ease. It will return true or false depending on whether it does exist or no. Let’s see the code below:
Comment::where('comment','Hello world')->doesntExist();
Comment::where('comment','Hello world')->exists();