jeudi 30 mai 2019

laravel request not redirect right page

i want to make a filter based on request 'kelas' on database table. it give me no error just when i click one of the filter it don't show jadwal page with my filter, it show the main page but the url is right like lps.com/?jadwal-2

i have done make a middleware called SanitizeMiddleware from Laravel $request->has('name') doesn't work but still not worked

this is my route web

Route::get('/', 'HomepageController@index');

Route::resource('pengumuman', 'PengumumanController');
Route::resource('jadwal', 'JadwalController');
Route::resource('rapot', 'RapotController');

this is my index() from my jadwalController

public function index()
    {
        if (request()->has('kelas')) {
            $jadwal = jadwal::where('kelas', request('kelas')); 
            }
            else{
            $jadwal = jadwal::all();
            }
            return view('jadwal.index')->with('jadwal',$jadwal);

        //$jadwal = jadwal::all();
        //return view('jadwal.index')->with('jadwal',$jadwal);
    }

this is my index blade

<div class="container">
    <br>
      <h1><strong>Jadwal Pelajaran</strong></h1>
    <a href="/?kelas=1">jadwwal kelas 1</a>
    <a href="/?kelas-2">jadwal kelas 2</a>
    <a href="/?kelas-3">jadwal kelas 3</a>
    </form>
    <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>



</div>

and this is the picture of problem this is my jadwal page before filter

this my page after i click the filter using request()



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

Aucun commentaire:

Enregistrer un commentaire