Php Laravel调度应用程序

Php Laravel调度应用程序,php,laravel,laravel-blade,Php,Laravel,Laravel Blade,我正在尝试制作一个前端时间表,您可以单击第8:30行中的单元格,然后弹出一个模式,您可以选择,直到您以半小时的增量保留从9:00开始的术语 只保留一个术语很好,因为我可以直接从循环中选择变量,但是我不知道如何将它转发到modal 控制器: public function index() { $scheduler_start_time = Carbon::createFromTime(6, 0, 0); $scheduler_end_time = Carbon::createFro

我正在尝试制作一个前端时间表,您可以单击第8:30行中的单元格,然后弹出一个模式,您可以选择,直到您以半小时的增量保留从9:00开始的术语

只保留一个术语很好,因为我可以直接从循环中选择变量,但是我不知道如何将它转发到modal

控制器:

public function index()
{
    $scheduler_start_time = Carbon::createFromTime(6, 0, 0);
    $scheduler_end_time = Carbon::createFromTime(20, 0, 0);

    $equipment = Equipment::with('reservations', 'reservations.user')->get();
    return view('landing', compact('equipment', 'scheduler_start_time', 'scheduler_end_time'));
}
前端的表循环:

@while($scheduler_start_time < $scheduler_end_time)
    <tr>
        <td>{{$scheduler_start_time->format('H:i:s')}}</td>
        @foreach($equipment as $instrument)
            <td>
                <a href="#" style="display: block;"
                   data-href="{{route('reserve-me', [$instrument->id, $scheduler_start_time->timestamp])}}"
                   data-toggle="modal" data-target="#confirm-reservation">
                    @if(!$instrument->reservations->where('reserved_from', $scheduler_start_time)->isEmpty())
                        {{$instrument->reservations->where('reserved_from', $scheduler_start_time)->first()->user->name}}
                    @else
                        &nbsp;
                    @endif
                </a>
            </td>
        @endforeach
        <?php $scheduler_start_time->addMinutes(30) ?>
    </tr>
@endwhile
@while($scheduler\u start\u time<$scheduler\u end\u time)
{{$scheduler\u start\u time->format('H:i:s')}
@foreach($设备作为$仪器)
@endforeach
@结束时
模态:

<!-- Modal -->
<div class="modal fade" id="confirm-reservation" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                New reservation
            </div>
            <div class="modal-body">
                Are you sure you want to add this reservation?
                <br><br>
                <div class="dropdown">
                    <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Reserve until
                        <span class="caret"></span></button>
                    <ul class="dropdown-menu">
                        <!-- *CLARIFICATION -->
                        <li><a href="#">{{$scheduler_start_time}}</a></li>
                    </ul>
                </div>

            </div>
            <div class="modal-footer">
                <a class="btn btn-primary btn-ok">Yes</a>
                <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
            </div>
        </div>
    </div>
</div>
<script>
    $('#confirm-reservation').on('show.bs.modal', function(e) {
        $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
    });
</script>

新预订
您确定要添加此预订吗?


留到
对 不 $(“#确认预订”)。on('show.bs.modal',函数(e){ $(this.find('.btn ok').attr('href',$(e.relatedTarget.data('href')); });
上面写着:*澄清:我试着一小步,至少得到我点击的值,但我总是得到20:00的最后时间