php - Laravel: Addition to an existing field data in a column -


please how express php mysql update code in eloquent

mysql_query("update `some_table` set `value` = `value` + 1000 `id` = 1"); 

or

mysql_query("update `some_table` set `value` = `value` + $formdata `id` = 1"); 

you can retrieve model , increment it:

$model = some_model::find( $id ); $model->value += 1000; $model->save(); 

Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -