first commit

This commit is contained in:
2026-07-06 20:16:00 +02:00
commit 352e6d9e22
147 changed files with 12242 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Controllers;
use App\Models\InstrumentModel;
class Investments extends BaseController
{
public function index()
{
$model = model(InstrumentModel::class);
$instruments = $model->withStats();
// Kafelki portfela = suma po instrumentach (spojne ze zrodlem prawdy w withStats).
$netInvested = 0.0;
$value = 0.0;
foreach ($instruments as $i) {
$netInvested += (float) $i['net_invested'];
$value += (float) $i['value'];
}
return view('investments/index', [
'title' => 'Pulpit inwestycji',
'instruments' => $instruments,
'net_invested' => round($netInvested, 2),
'value' => round($value, 2),
'profit' => round($value - $netInvested, 2),
'timeline' => $model->portfolioTimeline(),
]);
}
}