How to Check if a Record Does Not Exist in Laravel
in this lesson, we will see how to check if a record does not exist in laravel, sometimes you need to check for a record if it does not exist before performing some actions.
How to Check if a Record Does Not Exist in Laravel
To do that laravel provides a method 'doesNotExists()' that you can use to check if a record does not exist in the database.
Post::where('title', $request->title)->doesNotExists();