ensure profile
This commit is contained in:
@ -90,6 +90,19 @@ class User extends ActiveRecord implements IdentityInterface
|
|||||||
return parent::beforeSave($insert);
|
return parent::beforeSave($insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterSave($insert, $changedAttributes)
|
||||||
|
{
|
||||||
|
parent::afterSave($insert, $changedAttributes);
|
||||||
|
|
||||||
|
if ($insert && $this->profile === null) {
|
||||||
|
$profile = $this->make(Profile::class);
|
||||||
|
$profile->link('user', $this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user