我有这个链接,我打开模态:
<li><a href="#deleteProperty{{$property->id}}" data-toggle="modal"><i class="fa fa-times"></i></a></li>
我在单独的页面modals.blade.php
中有模态<div class="modal fade modal_form" id="deleteProperty{{$property->id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel5" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="exampleModalLabel5">Are you sure you want to delete this property?</h4>
</div>
<div class="modal-body">
<form method="POST" action="{{ route('user.property.delete',[$user->id,$property->id])}}">
<div class="form-group">
<div class="left-btn">
<button type="button" class="btn btn-primary" data-dismiss="modal">No</button>
</div>
<div class="right-btn">
<button type="submit" class="btn btn-primary">Yes</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
如何将此参数($ property-&gt; id)传递给模态,以便当用户点击特定属性时删除该属性?
答案 0 :(得分:1)
您需要在包含的视图中传递要使用的变量。
示例:
@include('standardUser.includes.modals', [ "property" => $property ])