'datetime', ]; public function memes() { return $this->hasMany(Meme::class)->orderByDesc('created_at'); } public function tips() { return $this->hasManyThrough(Tip::class, Meme::class, 'user_id'); } 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'); } }