I have a need to update a field in a database table to an MD5 hash of of the other field values (sting concat)
I am trying to do this via the eloquent model saving/updating/creating events but it appears that you cannot use the events to update/alter data.
Currently i have the following:
static::saving(function ($model) {
CustomLog::debug(__CLASS__, __FUNCTION__, __LINE__, 'saving fired');
$model->sku = static::generateSku($model);
});
This is not having the desired affect; is there a way to do this - I dont want to have to add a manual call to this function in various places as i feel it should be automatic.
Thanks in advance