在Laravel中,什么不等于?

时间:2019-03-04 07:34:28

标签: laravel-5 conditional-statements equals

我在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];

1 个答案:

答案 0 :(得分:2)

您可以编写如下:

$conditions = [
    ['player_id', auth()->id()],
    ['is_confirmed', 'pending'],
    ['user_id', '<>', auth()->id()]
];