mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2025-05-31 06:34:24 -04:00
Finish rough draft of website
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)
This commit is contained in:
parent
dbfda5cf9e
commit
821fb9b1ed
30 changed files with 186 additions and 261 deletions
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Address extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -14,7 +14,14 @@ class Meme extends Model
|
|||
use SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $appends = ['meme_tips_total'];
|
||||
protected $appends = ['meme_tips_total', 'image_url'];
|
||||
protected $hidden = [
|
||||
'payment_pending',
|
||||
'account_index',
|
||||
'is_approved',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
|
@ -28,14 +35,9 @@ class Meme extends Model
|
|||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function address()
|
||||
{
|
||||
return $this->belongsTo(Address::class);
|
||||
}
|
||||
|
||||
public function tips()
|
||||
{
|
||||
return $this->hasManyThrough(Tip::class, Address::class, 'id', 'address_id', 'address_id', 'id')->orderBy('created_at', 'DESC');
|
||||
return $this->hasMany(Tip::class)->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function getMemeTipsTotalAttribute()
|
||||
|
@ -43,6 +45,11 @@ class Meme extends Model
|
|||
return $this->tips->where('is_deposit', 1)->sum('amount_formatted');
|
||||
}
|
||||
|
||||
public function getImageUrlAttribute()
|
||||
{
|
||||
return url($this->image);
|
||||
}
|
||||
|
||||
public function setImageAttribute($value)
|
||||
{
|
||||
$attribute_name = "image";
|
||||
|
|
|
@ -9,13 +9,18 @@ class Tip extends Model
|
|||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $appends = ['amount_formatted'];
|
||||
protected $appends = ['amount_formatted', 'tx_url'];
|
||||
|
||||
public function getAmountFormattedAttribute()
|
||||
{
|
||||
return number_format(($this->amount)*(pow(10, -12)), 8, '.', '');
|
||||
}
|
||||
|
||||
public function getTxUrlAttribute()
|
||||
{
|
||||
return config('app.xmr_explorer_base_url') . $this->txid;
|
||||
}
|
||||
|
||||
public function address()
|
||||
{
|
||||
return $this->belongsTo(Address::class);
|
||||
|
|
|
@ -51,8 +51,7 @@ class User extends Authenticatable
|
|||
|
||||
public function tips()
|
||||
{
|
||||
return $this->hasManyThrough(Tip::class, Meme::class, 'address_id', 'id', 'id', 'address_id');
|
||||
return $this->hasManyThrough(Tip::class, Meme::class, 'id', 'address_id');
|
||||
return $this->hasManyThrough(Tip::class, Meme::class, 'user_id');
|
||||
}
|
||||
|
||||
public function getMemesTotalAttribute()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue