Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are no changes in the afterSave method #119

Open
alexey-bro opened this issue Jul 31, 2018 · 1 comment
Open

There are no changes in the afterSave method #119

alexey-bro opened this issue Jul 31, 2018 · 1 comment

Comments

@alexey-bro
Copy link

After the model is saved in the afterSave method, the attributes of the object are old and $changedAttributes is also empty.

public function afterSave($insert, $changedAttributes)
{
var_dump($this->depth); //old value
var_dump($changedAttributes) //empty
}

@ricksmort
Copy link

Had similar issue myself...
PHP 5
$old_title = null; $old_title = (empty($changedAttributes['title']) ? $new_title : $changedAttributes['title']);
PHP 7+
$old_title = $changedAttributes['title'] ?? null;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants