我在Laravel中使用条件。在以下情况下我该如何使用不等于?
$conditions = ['player_id' => auth()->id(), 'is_confirmed' => 'pending', 'user_id' <> auth()->id()];
编辑:
此外,在这种情况下如何使用or clause
:
$conditions = ['player_id' => auth()->id(), 'is_confirmed' => 'pending', 'user_id' <> auth()->id(), or 'is_deleted' => false];
答案 0 :(得分:2)
您可以编写如下:
$conditions = [
['player_id', auth()->id()],
['is_confirmed', 'pending'],
['user_id', '<>', auth()->id()]
];