mirror of
https://github.com/henry4682/finance_app.git
synced 2026-07-16 08:20:00 +00:00
32 lines
581 B
PHP
32 lines
581 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class InvestmentHolding extends Model
|
|
{
|
|
protected $fillable = [
|
|
'account_id',
|
|
'type',
|
|
'symbol',
|
|
'name',
|
|
'shares',
|
|
'avg_cost',
|
|
];
|
|
|
|
public function account()
|
|
{
|
|
return $this->belongsTo(Account::class);
|
|
}
|
|
|
|
public function transactions()
|
|
{
|
|
return $this->hasMany(InvestmentTransaction::class, 'holding_id');
|
|
}
|
|
|
|
public function security()
|
|
{
|
|
return $this->hasOne(Security::class, 'code', 'symbol');
|
|
}
|
|
} |