下拉菜单过滤器laravel

时间:2019-05-29 07:42:02

标签: php laravel laravel-5 eloquent

我想创建一个下拉菜单,该菜单根据班级过滤班级时间表,但我对基于下拉菜单中的“ kelas”以及索引方法在控制器中的工作方式进行查询感到困惑

this is the front end

这是我的下拉代码

<div class="form-group">
    <label for="jadwal">Pilih Jadwal Pelajaran</label>
    <select name="Sjadwal" id="Sjadwal">
        <option value="1">Kelas 1</option>
        <option value="2">Kelas 2</option>
        <option value="3">Kelas 3</option>
    </select>
</div>
<table class="table table-bordered">
    <thead>
    <tr>
        <th scope="col"></th>
        <th scope="col">07.00-08.00</th>
        <th scope="col">08.00-09.00</th>
        <th scope="col">09.00-10.00</th>
        <th scope="col">10.00-11.00</th>
        <th scope="col">10.00-12.00</th>
        <th scope="col">action</th>
    </tr>
    </thead>
    <tbody>
    @if(count($jadwal)>0)
        @foreach($jadwal as $jadwals)
            <tr>
                <th scope="row">{{$jadwals->hari}}</th>
                <td>{{$jadwals->jamke1}}</td>
                <td>{{$jadwals->jamke2}}</td>
                <td>{{$jadwals->jamke3}}</td>
                <td>{{$jadwals->jamke4}}</td>
                <td>{{$jadwals->jamke4}}</td>
                <td><a href="/jadwal/{{$jadwals->id}}/edit" class="btn btn-info">Edit</a></td>
            </tr>
        @endforeach
    @else
        <p>tidak ada jadwal</p>
    @endif
    </tbody>
</table> 

这是我的模特

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class jadwal extends Model
{
    protected $fillable = [
        'hari', 'kelas', 'jamke1','jamke2','jamke3','jamke4','jam5',
    ];
}
?>

0 个答案:

没有答案