mirror of
https://github.com/henry4682/finance_app.git
synced 2026-07-16 00:10:00 +00:00
feat: 前端分離+功能api化
1. 新增資產管理CRUD、googleOAuth登入 2. 更改原記帳controller
This commit is contained in:
32
app/Models/InvestmentHolding.php
Normal file
32
app/Models/InvestmentHolding.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user