是否可以雄辩地排除特定的行?
我想从查询#2中的查询#1中排除使用帖子ID数组的行。
您可以使用whereNotIn:
whereNotIn
Post::whereNotIn('id', array(1, 7, 21))->get();
您可以检查Laravel Query Builder Documentation以更好地了解其功能。
您还可以使用except排除以下特定行:
except
Post::all()->except([1,2,4]);