我有以下代码用于购买计划。当我单击计划时,它会打开一个具有选定计划ID的模型,并说出要输入的金额。
我希望它不是模态类型,但希望在单击时获得此ID隐藏的形式,并且允许在表单输入字段中写入金额。问题是当我删除模型时,它没有计划的ID
我已经尝试过将模型替换为表单,并将{{$gate->id}}
作为隐藏的值,但是它并不会仅在第一天获得所有计划的ID。
<div class="row">
@foreach($pack as $gate)
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="panel panel-primary">
<div class="panel-body text-center">
<p style="color: #000">Amount: {{$gate->min_amount}} {{$general->symbol}} - {{$gate->max_amount}} {{$general->symbol}}</p><br>
<p style="color: #000; font-weight: 700">Profit: {{$gate->percent}} % </p> <p>Period: {{$gate->period}} Hours</p>
<p style="color: green">Plan Duration {{$gate->action}} Hours</p>
</div>
<div class="panel-footer">
<button class="btn btn-primary btn-block" data-toggle="modal" data-target="#buyModal{{$gate->id}}">Invest</button>
</div>
</div>
</div>
<!--Buy Modal -->
<div id="buyModal{{$gate->id}}" class="modal fade" role="dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Invest via <strong>{{$gate->title}}</strong></h4>
</div>
<form method="POST" action="{{route('lend.preview')}}">
<div class="modal-body">
{{csrf_field()}}
<input type="hidden" name="package_id" value="{{$gate->id}}">
这是从计划到模态脚注的代码