'Laravel Eloquent: Load relations if other relations do not exist

Imagine the following example:

User::query()
 ->with('vacationDays')
 ->with('schoolDays')
 ->with('sickDays')
 ->get();

Is there any way to only eager load the schoolDays relation if the vacationDays has empty results? And only eager load sickDays if both the others are empty. The objective is to see if the user is busy or not, but also not doing too many queries. It must use eloquent features. Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source