Exemplo n.º 1
0
 /**
  * @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()')]]);
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 /**
  * @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']);
 }
Exemplo n.º 4
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => SluggableBehavior::className(), 'attribute' => 'name', 'ensureUnique' => true], ['class' => TimestampBehavior::className()], ['class' => ImageAttachmentBehavior::className()]]);
 }
Exemplo n.º 5
0
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['sluggableBehavior'] = ['class' => SluggableBehavior::className(), 'attribute' => 'name', 'slugAttribute' => 'alias', 'ensureUnique' => true];
     return $behaviors;
 }
Exemplo n.º 6
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [FileBehavior::className()]);
 }