Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用Laravel MySQL在引导模式框中获取数据_Php_Html_Mysql_Laravel - Fatal编程技术网

Php 如何使用Laravel MySQL在引导模式框中获取数据

Php 如何使用Laravel MySQL在引导模式框中获取数据,php,html,mysql,laravel,Php,Html,Mysql,Laravel,我使用Laravel应用程序,我们在datatable上显示数据。当我们使用foreach使用Bootstrap modal box更新数据时,只获取表中的最后一个数据 我们链接的按钮: @foreach($patients as $patient)<br> <li> <button type="button" class="btn btn-primary btn-sm" data-toggle

我使用Laravel应用程序,我们在datatable上显示数据。当我们使用foreach使用Bootstrap modal box更新数据时,只获取表中的最后一个数据

我们链接的按钮:

@foreach($patients as $patient)<br>
    <li>
        <button type="button"
            class="btn btn-primary btn-sm"
            data-toggle="modal"
            data-target="#myModal{{$patient->patient_id}}">Update Fee</button>
    </li>
@endforeach
@foreach($patients作为$patient)
  • 更新费
  • @endforeach
    模式框:

    <div id="myModal{{$patient->patient_id}}" class="modal fade" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title"><span class="glyphicon glyphicon-edit"></span>&nbsp;Edit Fee</h4>
                </div>
                <div class="modal-body">
                    <form>
                        <div class="form-group">
                            <label> Total Fee</label>
                            <input type="text" name="fee" class="form-control" readonly value="{{$patient->Fee->Fee}}" />
                            <input type="hidden" name="id" class="form-control">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    
    
    &时代;
    编辑费
    总费用
    
    只需在@foreach指令(您的循环)中插入您的模态,就可以在当前代码中使用

    @foreach($patients as $patient)<br>
    <li>
        <button type="button"
                class="btn btn-primary btn-sm"
                data-toggle="modal"
                data-target="#myModal{{$patient->patient_id}}">Update Fee</button>
    </li>
    
    <div id="myModal{{$patient->patient_id}}" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title"><span class="glyphicon glyphicon-edit"></span>&nbsp;Edit Fee</h4>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label> Total Fee</label>
                        <input type="text" name="fee" class="form-control" readonly value="{{$patient->Fee->Fee}}" />
                        <input type="hidden" name="id" class="form-control">
                    </div>
                </form>
            </div>
        </div>
    </div>
    @endforeach
    
    @foreach($patients作为$patient)
  • 更新费
  • &时代; 编辑费 总费用 @endforeach
    您能给我们看一些代码吗?让我们知道你做了什么?问题是什么?你在循环模式吗?是的,循环引导模型框,但只获取最后一个id不是全部,如何解决它