如何在wheres数组中使用运算符

php*_*per 1 laravel eloquent laravel-5.6

我正在尝试=>在wheres数组中使用运算符,但查询将运算符用作绑定

Model::updateOrCreate([
        ['client_id', $client->id],
        ['created_at', '=>', '2019-05-01 00:00:00',],
    ],
    [
        'client_id' => $client->id,
    ]
);
Run Code Online (Sandbox Code Playgroud)

这不起作用,查询看起来像这样

[
    "query"    =>
        "select * from `models` where (`client_id` = ? and `created_at` = ?) limit 1",
    "bindings" => [
        0 => 5,
        1 => "=>",
    ],
];
Run Code Online (Sandbox Code Playgroud)

我在网上搜索,但找不到该功能的适当文档 addArrayOfWheres

谢谢。

Jer*_*dev 7

=>不是有效的子句运算符,应使用>=

在源代码中可以找到允许的运算符的完整列表。

/**
 * All of the available clause operators.
 *
 * @var array
 */
public $operators = [
    '=', '<', '>', '<=', '>=', '<>', '!=', '<=>',
    'like', 'like binary', 'not like', 'ilike',
    '&', '|', '^', '<<', '>>',
    'rlike', 'regexp', 'not regexp',
    '~', '~*', '!~', '!~*', 'similar to',
    'not similar to', 'not ilike', '~~*', '!~~*',
];
Run Code Online (Sandbox Code Playgroud)