money::class, 'after' => money::class, 'amount' => money::class, 'link_logs' => 'array'];
protected $guarded = [];
public function scopeUid(Builder $query): Builder
{
return $query->whereUserId(Auth::id());
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function referral_logs(): Builder
{
return ReferralLog::whereIn('id', $this->link_logs);
}
protected function amountTag(): Attribute
{
return Attribute::make(get: fn () => Helpers::getPriceTag($this->amount));
}
protected function statusLabel(): Attribute
{
return Attribute::make(get: fn () => match ($this->status) {
1 => ''.trans('common.status.pending').'',
2 => trans('common.status.withdrawn'),
default => ''.trans('common.status.applying').'',
});
}
}