| 123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Models;
- class MerchantModel extends BaseModel
- {
- protected $table = 'merchant';
- /**
- * UUID 键名
- * @var string
- */
- protected $uuidKeyName = 'uid';
- protected static function boot()
- {
- parent::boot();
- self::created(function ($model) {
- $uuid = hashEncodeId($model->id);
- $model->{$model->uuidKeyName} = $uuid;
- $model->save();
- });
- }
- public function merchantPaymentType()
- {
- return $this->hasMany(MerchantPaymentTypeModel::class, 'merchant_uid', 'uid');
- }
- }
|