Je kunt Eloquent's whereDoesntHave() . gebruiken beperking om te krijgen wat je nodig hebt:
// get all Videos that don't belong to category 2 and 3
Video::whereDoesntHave('categories', function($query) {
$query->whereIn('id', [2, 3]);
})->get();
Je kunt Eloquent's whereDoesntHave() . gebruiken beperking om te krijgen wat je nodig hebt:
// get all Videos that don't belong to category 2 and 3
Video::whereDoesntHave('categories', function($query) {
$query->whereIn('id', [2, 3]);
})->get();