示例#1
0
文件: Topic.php 项目: Kulkow/mainsite
 public function behaviors()
 {
     return ['alias' => ['class' => 'common\\behaviors\\Alias', 'in_attribute' => 'h1', '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()], 'UploadImage' => ['class' => UploadImage::className(), 'attribute' => 'preview', 'scenarios' => ['insert', 'update'], 'path' => '@uploadroot/topic/{id}', 'url' => '@upload/topic/{id}', 'thumbPath' => '@uploadroot/topic/{id}/thumb', 'thumbUrl' => '@upload/topic/{id}/thumb', 'thumbs' => ['big' => ['width' => 400, 'quality' => 90], 'small' => ['width' => 200, 'height' => 200]]]];
 }
示例#2
0
文件: User.php 项目: Kulkow/mainsite
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['timestampBehavior' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at']], 'UploadImage' => ['class' => UploadImage::className(), 'attribute' => 'preview', 'scenarios' => ['insert', 'update'], 'path' => '@uploadroot/user/{id}', 'url' => '@upload/user/{id}', 'thumbPath' => '@uploadroot/user/{id}/thumb', 'thumbUrl' => '@upload/user/{id}/thumb', 'thumbs' => ['big' => ['width' => 400, 'quality' => 90], 'small' => ['width' => 200, 'height' => 200, 'crop' => true]]]];
 }