40 lines
890 B
PHP
40 lines
890 B
PHP
|
<?php
|
||
|
|
||
|
namespace Koneko\VuexyStoreManager\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Koneko\VuexyAdmin\Models\User;
|
||
|
|
||
|
class CurrencyExchangeRate extends Model
|
||
|
{
|
||
|
protected $table = 'currency_exchange_rates';
|
||
|
|
||
|
protected $fillable = [
|
||
|
'c_currency',
|
||
|
'exchange_rate',
|
||
|
'exchange_date',
|
||
|
'source',
|
||
|
'updated_by',
|
||
|
'comments',
|
||
|
];
|
||
|
|
||
|
protected $casts = [
|
||
|
'exchange_rate' => 'decimal:6',
|
||
|
'exchange_date' => 'date',
|
||
|
'source' => 'string',
|
||
|
'updated_by' => 'integer',
|
||
|
];
|
||
|
|
||
|
// Relación con la moneda
|
||
|
public function currency()
|
||
|
{
|
||
|
return $this->belongsTo(Currency::class, 'c_currency', 'c_currency');
|
||
|
}
|
||
|
|
||
|
// Relación con el usuario que actualizó el tipo de cambio
|
||
|
public function updatedByUser()
|
||
|
{
|
||
|
return $this->belongsTo(User::class, 'updated_by');
|
||
|
}
|
||
|
}
|