| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace App\Models\Agent;
- use App\Models\BaseModel;
- class AgentEquityOrder extends BaseModel
- {
- public const STATUS_PENDING = 'pending_payment';
- public const STATUS_COMPLETED = 'completed';
- public const STATUS_CANCELLED = 'cancelled';
- protected $table = 'agent_equity_orders';
- protected $guarded = ['id'];
- protected $hidden = [];
- protected $appends = ['status_text'];
- protected $casts = [
- 'agent_id' => 'integer', 'percent' => 'decimal:4', 'price_per_percent' => 'decimal:4',
- 'amount' => 'decimal:4', 'completed_at' => 'datetime',
- ];
- public function agent()
- {
- return $this->belongsTo(Agent::class);
- }
- public function getStatusTextAttribute(): string
- {
- return [self::STATUS_PENDING => '待付款', self::STATUS_COMPLETED => '已开通', self::STATUS_CANCELLED => '已取消'][(string) $this->status] ?? '';
- }
- }
|