1 개요[ | ]
- Laravel Query Builder 업데이트
- 라라벨 쿼리빌더 update
일반 컬럼 업데이트
PHP
Copy
DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
JSON 컬럼 업데이트
PHP
Copy
DB::table('users')
->where('id', 1)
->update(['options->enabled' => true]);
증가, 감소
PHP
Copy
DB::table('users')->increment('votes');
DB::table('users')->increment('votes', 5);
DB::table('users')->decrement('votes');
DB::table('users')->decrement('votes', 5);
2 같이 보기[ | ]
3 참고[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.