/** * @inheritdoc * * Use yii\behaviors\TimestampBehavior for created_at and updated_at attribute * @return array */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), [['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', 'value' => new Expression('NOW()')]]); }
public function behaviors() { $behaviors = parent::behaviors() + ['alias' => ['class' => 'common\\behaviors\\Alias', 'in_attribute' => 'name', 'out_attribute' => 'alias', 'translit' => true], 'timestampBehavior' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created', 'updated'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated']], 'ownerBehavior' => ['class' => BlameableBehavior::className(), 'createdByAttribute' => 'owner', 'updatedByAttribute' => 'editor'], 'SeoBehavior' => ['class' => SeoBehavior::className(), 'SourceAttribute' => 'name']]; return $behaviors; }
/** * @inheritdoc * * Use yii\behaviors\TimestampBehavior for created_at and updated_at attribute * * @return array */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), [['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', 'value' => new Expression('NOW()')], 'bedezign\\yii2\\audit\\AuditTrailBehavior']); }
/** * @return array */ public function behaviors() { return array_merge(parent::behaviors(), [['class' => SluggableBehavior::className(), 'attribute' => 'name', 'ensureUnique' => true], ['class' => TimestampBehavior::className()], ['class' => ImageAttachmentBehavior::className()]]); }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['sluggableBehavior'] = ['class' => SluggableBehavior::className(), 'attribute' => 'name', 'slugAttribute' => 'alias', 'ensureUnique' => true]; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { return array_merge(parent::behaviors(), [FileBehavior::className()]); }