mirror of
https://github.com/henry4682/finance_app.git
synced 2026-07-16 00:10:00 +00:00
33 lines
670 B
PHP
33 lines
670 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Security extends Model
|
|
{
|
|
protected $fillable = [
|
|
'code',
|
|
'type',
|
|
'source',
|
|
'name',
|
|
'latest_price',
|
|
'latest_price_at',
|
|
'change_amount',
|
|
'change_rate',
|
|
'meta',
|
|
];
|
|
|
|
protected $casts = [
|
|
'latest_price_at' => 'datetime',
|
|
'latest_price' => 'decimal:4',
|
|
'change_amount' => 'decimal:4',
|
|
'change_rate' => 'decimal:4',
|
|
'meta' => 'array',
|
|
];
|
|
|
|
public function historicPrices()
|
|
{
|
|
return $this->hasMany(SecurityPriceHistories::class, 'security_id', 'id');
|
|
}
|
|
} |