mercredi 29 mai 2019

dropdown menu filter laravel

I want to make a dropdown menu that filters class schedules based on class but I am confused about making queries based on the "kelas" in the dropdown menu and how the index method works in my controller

this is the front end

this is my code for dropdown

<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"></th>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td><a href="/jadwal//edit" class="btn btn-info">Edit</a></td>
            </tr>
        @endforeach
    @else
        <p>tidak ada jadwal</p>
    @endif
    </tbody>
</table> 

this is my model

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



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2HHU9MY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire