| 1234567891011121314151617181920 |
- <?php
- namespace App\Models;
- use App\Support\PromotionRules;
- /** Independent campaigns. They never appear in activity_rewards or its legacy catalog. */
- class PromotionActivity extends BaseModel
- {
- protected $table = 'promotion_activities';
- protected $guarded = ['id', 'rewarded_count', 'budget_used'];
- protected $fillable = ['title', 'translations', 'type', 'status', 'start_time', 'end_time', 'lang', 'sort', 'params', 'content', 'image',
- 'publish_platforms', 'register_time_limited', 'register_start_time', 'register_end_time', 'register_platforms',
- 'deposit_limited', 'deposit_min', 'deposit_max', 'show_ineligible', 'reward_quota', 'budget'];
- protected $casts = ['translations' => 'array', 'publish_platforms' => 'array', 'register_platforms' => 'array', 'register_time_limited' => 'boolean',
- 'deposit_limited' => 'boolean', 'show_ineligible' => 'boolean', 'quota_enabled' => 'boolean', 'budget' => 'decimal:2', 'budget_used' => 'decimal:2',
- 'reward_quota' => 'integer', 'rewarded_count' => 'integer', 'deposit_min' => 'decimal:2', 'deposit_max' => 'decimal:2'];
- protected $appends = ['type_name'];
- protected function getTypeNameAttribute(): ?string { return PromotionRules::types()[(int)($this->attributes['type'] ?? 0)] ?? null; }
- }
|