Back

Hey Laravel Developers

You might have used the exists() method on the Query Builder class to check for the existence of a record in the database.

But did you know we also have the existsOr() and doesntExistOr() methods available?

These methods accept a callback function as an argument, which is triggered based on the existence or non-existence of the record.

To me, it feels like a more convenient and readable way to write code.

Check out the example below!

image

43

  • No matching results...
  • Searching...

/ 1000