i've use blameablebehavior in of controller want manually set user created value can't work.
public function behaviors() { return [ blameablebehavior::classname(), ]; }
this not work.
$model->createdby = 1; $model->save();
it try use blameablebehavior
.
how can manually add it. thanks.
try use named behavior , detach before saving model:
public function behaviors() { return [ 'blameable' => blameablebehavior::classname(), ]; }
and then:
$model->detachbehavior('blameable'); $model->createdby = 1; $model->save();
Comments
Post a Comment