2021-07-16 02:35:54 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class Tip extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
2021-08-06 16:06:07 -04:00
|
|
|
protected $appends = ['amount_formatted', 'tx_url'];
|
2021-07-16 02:35:54 -04:00
|
|
|
|
|
|
|
public function getAmountFormattedAttribute()
|
|
|
|
{
|
|
|
|
return number_format(($this->amount)*(pow(10, -12)), 8, '.', '');
|
|
|
|
}
|
|
|
|
|
2021-08-06 16:06:07 -04:00
|
|
|
public function getTxUrlAttribute()
|
|
|
|
{
|
|
|
|
return config('app.xmr_explorer_base_url') . $this->txid;
|
|
|
|
}
|
|
|
|
|
2021-07-16 02:35:54 -04:00
|
|
|
public function address()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Address::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|