debug for dailychanges

This commit is contained in:
hackerESQ
2024-09-25 20:59:09 -05:00
parent 32fed82772
commit ed4d955507
3 changed files with 18 additions and 5 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ class DailyChange extends Model
{
return $this->whereHas('portfolio', function ($query) {
$query->whereHas('users', function ($query) {
$query->where('id', auth()->id());
return $query->where('id', auth()->id());
});
});
}
@@ -45,10 +45,14 @@ new class extends Component {
date,
SUM(total_market_value) as total_market_value,
SUM(total_cost_basis) as total_cost_basis,
SUM(total_gain) as total_gain,
--SUM(realized_gains) as realized_gains,
--SUM(total_dividends_earned) as total_dividends_earned
')->groupBy('date');
SUM(total_gain) as total_gain
/* ,
SUM(realized_gains) as realized_gains,
SUM(total_dividends_earned) as total_dividends_earned
*/
')
->groupBy('date')
->orderByDesc('date');
}
+9
View File
@@ -5,6 +5,7 @@ use App\Http\Controllers\HoldingController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\PortfolioController;
use App\Http\Controllers\TransactionController;
use App\Models\DailyChange;
use Laravel\Jetstream\Http\Controllers\Livewire\PrivacyPolicyController;
use Laravel\Jetstream\Http\Controllers\Livewire\TermsOfServiceController;
@@ -19,6 +20,14 @@ Route::get('/', function () {
Route::get('/test', function () {
//
return DailyChange::myDailyChanges()->selectRaw('
date,
SUM(total_market_value) as total_market_value,
SUM(total_cost_basis) as total_cost_basis,
SUM(total_gain) as total_gain
')
->groupBy('date')
->orderByDesc('date')->get()->toArray();
});
Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () {