使用 Laravel Fluent 如何根据字符串数组排除某些行


Using Laravel Fluent how can I exclude certain rows based on an array of strings?

在我的控制器文件中,我有这个:

$standard_sets = ['A', 'B', 'C', 'D', 'E'];
$exclude_list = ['str1', 'str2', 'str3'];

我想根据排除数组排除某些行。像这样:

$query->whereIn('cards.setCode', $standard_sets)
->exclude('cards.name', $exclude_list);

写这个的正确方法是什么?

whereNotIn()怎么样?

$query->whereIn('cards.setCode', $standard_sets)
      ->whereNotIn('cards.name', $exclude_list);