I have two tables, the typical master-detail, what I intend to do is obtain the master's records, while the registration number obtained by means of a where of the relationship is greater than n
I've been doing this until now
Master::withTrashed()
->with('details')
->withCount(['details' => function ($query) {
$query->whereDate('date_init', '<', Carbon::now()->toDateString());
}]);
with this I get the master and its details with the given conditions, but there are teachers that the count of the relationship is 0, that I want to ignore. How can I do this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire