laravel check if model relation exists 1

laravel check if model relation exists

$model->relation()->exists()

Here is what the above code is Doing:
1. We’re using the relation() method to get the relation object.
2. We’re using the exists() method to check if the relation exists.

Similar Posts