Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel increment column value in update query

DB::table('my_table')
   ->where('rowID', 1)
   ->update([
       'column1' => DB::raw('column1 + 2'),
       'column2' => DB::raw('column2 + 10'),
       'column3' => DB::raw('column3 + 13'),
       'column4' => DB::raw('column4 + 5'),
   ]);
Comment

update eloquent with increment laravel

Product::where('id',$id)
->increment('quantity', 4, ['updated_at' => Carbon::now()]);
or
// Increment by 1
Product::find($product_id)->increment('quantity');
//Increment by entered number "2"
Product::find($product_id)->increment('quantity', 2);
or
// Increment by 1
DB::table('products')->increment('quantity');
//Increment by entered number "2"
DB::table('products')->increment('quantity', 2);
  
Comment

PREVIOUS NEXT
Code Example
Php :: Internal error: xmlSchemaXPathProcessHistory, The state object to be removed is not the first in the list. 
Php :: include a website in php file 
Php :: save error cakephp 2 
Php :: laravel now date 
Php :: laravel get host with http 
Php :: Fetch Data From Database With MySQLI 
Php :: custom bootstrap pagination laravel 
Php :: get the value of href in string php 
Php :: whats the meaninig of void functions in php 
Php :: placa de carro mercossul brasil 
Php :: laravel gigapay update employee 
Php :: php header base64 pdf 
Php :: unique laravel migration 
Php :: qual é a melhor linguagem de programação para iniciantes 
Php :: wp override home url with php 
Php :: destroy php variable 
Php :: php remove double spaces to single space 
Php :: php check if its a name 
Php :: ajax update method in php pdo 
Php :: string to int laravel 
Php :: install symfony ubuntu 
Php :: get the last inserted id using laravel eloquent 
Php :: replace all php 
Php :: php return loading message 
Php :: codeigniter set timezone 
Php :: cut out the beginning of the text in php 
Php :: php regex string start 
Php :: php sessions 
Php :: laravel check if session variable exists 
Php :: get current year php 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =