mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2025-07-24 07:20:38 -04:00
Add tips count to leaderboard
Also rename memes_total to memes_count to make it more consistent
This commit is contained in:
parent
bb8ee230a6
commit
4c1b493943
4 changed files with 12 additions and 5 deletions
|
@ -11,7 +11,7 @@ class User extends Authenticatable
|
|||
{
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
protected $appends = ['tips_total', 'memes_total'];
|
||||
protected $appends = ['tips_count', 'tips_total', 'memes_count'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
@ -54,11 +54,16 @@ class User extends Authenticatable
|
|||
return $this->hasManyThrough(Tip::class, Meme::class, 'user_id');
|
||||
}
|
||||
|
||||
public function getMemesTotalAttribute()
|
||||
public function getMemesCountAttribute()
|
||||
{
|
||||
return $this->memes->count();
|
||||
}
|
||||
|
||||
public function getTipsCountAttribute()
|
||||
{
|
||||
return $this->tips->where('is_deposit', 1)->count();
|
||||
}
|
||||
|
||||
public function getTipsTotalAttribute()
|
||||
{
|
||||
return $this->tips->where('is_deposit', 1)->sum('amount_formatted');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue