Handling Non-Existent Models with Laravel's existsOr Method
Need to handle cases when a model doesn't exist? Laravel's existsOr method provides an elegant way to execute code when a model query returns no results.
Basic Usage
Handle non-existent models with a closure:
Model::where(...)
->existsOr(function () {
// Some logic if the model does