mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
37 lines
728 B
PHP
37 lines
728 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Currency extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\CurrencyFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'code',
|
|
'symbol',
|
|
'rate',
|
|
];
|
|
|
|
// protected function casts(): array
|
|
// {
|
|
// return [
|
|
// 'rate'=>MoneyCast::class
|
|
// ];
|
|
// }
|
|
|
|
protected function getCurrencySymbolAttribute(): string
|
|
{
|
|
return $this->symbol ?? $this->code;
|
|
}
|
|
|
|
protected function getCodeNameAttribute(): string
|
|
{
|
|
return $this->code.' - '.$this->name;
|
|
}
|
|
}
|