| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace common\behaviors;
- use Yii;
- use yii\behaviors\BlameableBehavior;
- use yii\db\ActiveRecord;
- /**
- * Trait MerchantBehavior
- * @package common\components
- */
- trait MerchantBehavior
- {
- /**
- * @return array
- */
- public function behaviors()
- {
- $behaviors = parent::behaviors();
- $behaviors[] = [
- 'class' => BlameableBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['merchant_id'],
- ],
- 'value' => Yii::$app->services->merchant->getNotNullId(),
- ];
- return $behaviors;
- }
- }
|