예제 #1
0
 /**
  * @param Model $model
  * @return void
  */
 public function delete($model)
 {
     if ($this->softDelete) {
         $model->setAttribute($this->deleteField, $this->deletedValue);
         $model->save(false, [$this->deleteField]);
     } else {
         $model->delete();
     }
 }
예제 #2
0
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'createdAt', 'updatedAtAttribute' => 'updatedAt']]);
 }