Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

check if value change laravel

If you want to check if the model is dirty just call isDirty():

if($product->isDirty()){
    // changes have been made
}
Or if you want to check a certain attribute:

if($product->isDirty('price')){
    // price has changed
}

refrence: https://stackoverflow.com/questions/28866500/laravel-eloquent-update-just-if-changes-have-been-made
 
PREVIOUS NEXT
Tagged: #check #change #laravel
ADD COMMENT
Topic
Name
7+9 =