如果新记录不存在,插入新记录或更新的简写是什么?
<?php
$shopOwner = ShopMeta::where('shopId', '=', $theID)
->where('metadataKey', '=', 2001)->first();
if ($shopOwner == null) {
// Insert new record into database
} else {
// Update the existing record
}
Run Code Online (Sandbox Code Playgroud) 我们如何使用Eloquent ORM在Laravel中执行批量数据库插入?
我想在Laravel中完成此任务:https://stackoverflow.com/a/10615821/600516 但我收到以下错误.
SQLSTATE [HY093]:参数号无效:混合命名和位置参数.