hide holding page if qty = 0
This commit is contained in:
@@ -14,7 +14,6 @@ class HoldingController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(Request $request, Portfolio $portfolio, String $symbol)
|
public function show(Request $request, Portfolio $portfolio, String $symbol)
|
||||||
{
|
{
|
||||||
|
|
||||||
$holding = Holding::with([
|
$holding = Holding::with([
|
||||||
'market_data',
|
'market_data',
|
||||||
'transactions' => function ($query) use ($symbol) {
|
'transactions' => function ($query) use ($symbol) {
|
||||||
@@ -25,6 +24,11 @@ class HoldingController extends Controller
|
|||||||
->portfolio($portfolio->id)
|
->portfolio($portfolio->id)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
|
if ($holding->quantity <= 0) {
|
||||||
|
|
||||||
|
return redirect(route('portfolio.show', ['portfolio' => $portfolio->id]));
|
||||||
|
}
|
||||||
|
|
||||||
return view('holding.show', compact(['portfolio', 'holding']));
|
return view('holding.show', compact(['portfolio', 'holding']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user