小编php*_*per的帖子

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

我正在尝试=>在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

谢谢。

laravel eloquent laravel-5.6

1
推荐指数
1
解决办法
49
查看次数

标签 统计

eloquent ×1

laravel ×1

laravel-5.6 ×1