mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2024-12-22 22:19:25 -05:00
821fb9b1ed
Update the payment code so everything is working now Improve DB structure Improve design Add API Validate XMR Address upon registration And Much More... Still Need to work on: - SEO - Dropdown in menu (bug, not dropping down)
68 lines
1.3 KiB
PHP
68 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use HasFactory, Notifiable;
|
|
|
|
protected $appends = ['tips_total', 'memes_total'];
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'address',
|
|
'password',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for arrays.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'email_verified_at' => '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 getMemesTotalAttribute()
|
|
{
|
|
return $this->memes->count();
|
|
}
|
|
|
|
public function getTipsTotalAttribute()
|
|
{
|
|
return $this->tips->where('is_deposit', 1)->sum('amount_formatted');
|
|
}
|
|
|
|
}
|