【文件属性】:
文件名称:eloquent-insert-on-duplicate-key:用于在重复密钥更新上进行INSERT的宏和使用Eloquent进行INSERT IGNORE的宏
文件大小:5KB
文件格式:ZIP
更新时间:2021-02-03 10:51:34
mysql php laravel eloquent macros
Laravel在重复的密钥上插入并忽略插入
不推荐使用此软件包,因为已将upsert和insertOrIgnore添加到Laravel。
如果需要透视功能,则可以轻松实现:
BelongsToMany :: macro ( 'attachUpsert' , function ( $ id , array $ attributes = []) {
$ this -> newPivotStatement ()-> upsert ( $ this -> formatAttachRecords (
$ this -> parseIds ( $ id ),
$ attributes
), null );
});
BelongsToMany :: macro ( 'attachOrIgnore' , function ( $ id , array $ attributes = []) {
$ this -> newPivotStatement ()-> insertOrIgnore ( $ this -> formatAttachReco
【文件预览】:
eloquent-insert-on-duplicate-key-master
----README.md(3KB)
----LICENSE(1KB)
----composer.json(829B)
----src()
--------InsertOnDuplicateKeyServiceProvider.php(5KB)