sarga/packages/Webkul/Core/src/Models/Currency.php

39 lines
815 B
PHP
Raw Normal View History

2018-07-24 11:11:32 +00:00
<?php
namespace Webkul\Core\Models;
use Illuminate\Database\Eloquent\Model;
2019-02-18 07:30:40 +00:00
use Webkul\Core\Contracts\Currency as CurrencyContract;
2018-07-24 11:11:32 +00:00
2019-02-18 07:30:40 +00:00
class Currency extends Model implements CurrencyContract
2018-07-24 11:11:32 +00:00
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
2020-03-04 06:32:53 +00:00
protected $fillable = [
'code',
'name',
'symbol',
];
/**
* Set currency code in capital
*
* @param string $value
* @return void
*/
public function setCodeAttribute($code)
{
$this->attributes['code'] = strtoupper($code);
}
/**
* Get the currency_exchange associated with the currency.
*/
public function CurrencyExchangeRate()
{
2019-02-18 07:30:40 +00:00
return $this->hasOne(CurrencyExchangeRateProxy::modelClass(), 'target_currency');
}
2018-07-24 11:11:32 +00:00
}