public function beforeSave() { // // Fill auth_id on message if there is a user authenticated. // $auth_token = AuthToken::current(); if ($auth_token) { $this->setAttribute('auth_id', $auth_token->auth_id); } parent::beforeSave(); }