2016-10-27 30 views
1

我該如何增加?取而代之的+1只顯示 '1'如何用散列火箭增加?

\App\Coupon::where('coupon_id','=',$coupon[0]->coupon_id)->update(['no_applied' => 'no_applied'+1]); 
+0

是否要追加'1',而不是添加呢? –

+0

@AlexanderFarber增量是正常的,但你能教我如何追加?我想學習 –

回答

0

您可以使用justr increment方法:

App\Coupon::where('coupon_id','=',$coupon[0]->coupon_id)->increment('no_applied'); 
+0

你是對的。謝謝。我會在後面標記你的答案,因爲stackoverflow不會允許我。無法接受10分鐘的答案 –