如何在 wheres 数组中使用运算符
How to use operators in array of wheres
我正在尝试在 wheres 数组中使用 =>
运算符
但查询使用运算符作为绑定
Model::updateOrCreate([
['client_id', $client->id],
['created_at', '=>', '2019-05-01 00:00:00',],
],
[
'client_id' => $client->id,
]
);
这不起作用,查询看起来像这样
[
"query" =>
"select * from `models` where (`client_id` = ? and `created_at` = ?) limit 1",
"bindings" => [
0 => 5,
1 => "=>",
],
];
我在网上搜索过,但找不到该功能的正确文档
addArrayOfWheres
谢谢。
=>
不是子句的有效运算符,您应该使用 >=
.
可以找到允许的运算符的完整列表 in the source code。
/**
* 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', '~~*', '!~~*',
];
我正在尝试在 wheres 数组中使用 =>
运算符
但查询使用运算符作为绑定
Model::updateOrCreate([
['client_id', $client->id],
['created_at', '=>', '2019-05-01 00:00:00',],
],
[
'client_id' => $client->id,
]
);
这不起作用,查询看起来像这样
[
"query" =>
"select * from `models` where (`client_id` = ? and `created_at` = ?) limit 1",
"bindings" => [
0 => 5,
1 => "=>",
],
];
我在网上搜索过,但找不到该功能的正确文档
addArrayOfWheres
谢谢。
=>
不是子句的有效运算符,您应该使用 >=
.
可以找到允许的运算符的完整列表 in the source code。
/**
* 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', '~~*', '!~~*',
];