Files
investbrain/app/Http/Controllers/HoldingController.php
T

30 lines
670 B
PHP
Raw Normal View History

2024-08-26 19:54:45 -05:00
<?php
namespace App\Http\Controllers;
2024-08-26 21:34:13 -05:00
use App\Models\Holding;
use App\Models\Portfolio;
use Illuminate\Http\Request;
2024-08-26 19:54:45 -05:00
class HoldingController extends Controller
{
/**
* Display the specified resource.
*/
2024-08-26 21:34:13 -05:00
public function show(Request $request, Portfolio $portfolio, String $symbol)
2024-08-26 19:54:45 -05:00
{
2024-08-26 22:13:00 -05:00
$holding = $request->user()
->holdings()
->where([
'holdings.portfolio_id' => $portfolio->id,
'holdings.symbol' => $symbol
])->firstOrFail();
2024-08-26 21:34:13 -05:00
$market_data = $holding->market_data;
return view('holding.show', compact(['portfolio', 'holding', 'market_data']));
2024-08-26 19:54:45 -05:00
}
}