Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change the default behaviour of 'WhoDidiT' in cakephp

I am using 'WhoDidiT' in my model to insert user_id. Its working fine. Now i need to insert a different user_id instead of the logged in user_id. Is there any way to insert the different user_id without modifying 'WhoDidiT'

var $actsAs = array(
    'WhoDidIt'=>array(
                     'created_by_field'=>'created_by',
                     'modified_by_field'=>'modified_by'
                ),

 );
like image 987
Tikaram Bhandari Avatar asked Dec 15 '25 19:12

Tikaram Bhandari


1 Answers

After you save, you can update that specific field

$this->Model->saveField('created_by',$id);

this will do the trick

like image 63
Pratik Red Shrestha Avatar answered Dec 17 '25 16:12

Pratik Red Shrestha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!