money::class, 'commission' => money::class];
protected $guarded = [];
public function scopeUid(Builder $query): Builder
{
return $query->whereInviterId(Auth::id());
}
public function invitee(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function inviter(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function order(): BelongsTo
{
return $this->belongsTo(Order::class);
}
public function getAmountTagAttribute(): string
{
return Helpers::getPriceTag($this->amount);
}
public function getCommissionTagAttribute(): string
{
return Helpers::getPriceTag($this->commission);
}
public function getStatusLabelAttribute(): string
{
return match ($this->attributes['status']) {
1 => ''.trans('common.status.applying').'',
2 => ''.trans('common.status.withdrawn').'',
default => ''.trans('common.status.unwithdrawn').'',
};
}
}