亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel 雄辯地插入到選擇中

Laravel 雄辯地插入到選擇中

PHP
天涯盡頭無女友 2022-12-23 15:44:48
我正在嘗試 laravel eloquent for sql insert into select query 如下 -$refId='111';$newStatus='S2';INSERT INTO parcel(items, status) SELECT items,'$newStatus' FROM parcel where ref_id ='$refId' LIMIT 1;此查詢使用newStatus變量插入到我的數據庫的包裹表中,從數據庫中選擇所需的某些項目。我需要使用 laravel eloquent 來做到這一點,但找不到任何可靠的方法。提前致謝。
查看完整描述

2 回答

?
繁花不似錦

TA貢獻1851條經驗 獲得超4個贊

// First Create Model Parcel and FInd Your required row with id


// Below code use for selecting data from database. 


$parcel = Parcel::query()->where('database column name', '=', $parcel_id)->first()


// If you want to store data in table use below code.


$parcel = new Parcel();

$percel->items = $item;

$percel->status = $newStatus;

$percel->save();


查看完整回答
反對 回復 2022-12-23
?
泛舟湖上清波郎朗

TA貢獻1818條經驗 獲得超3個贊

// First Create Model Parcel and FInd Your required row with id


// Below code use for selecting data from database. 


$parcel = Parcel::query()->where('database column name', '=', $parcel_id)->first()


// If you want to store data in table use below code.


$parcel = new Parcel();

$percel->items = $item;

$percel->status = $newStatus;

$percel->save();


查看完整回答
反對 回復 2022-12-23
  • 2 回答
  • 0 關注
  • 129 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號