Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

javascript - The PUT method is not supported for this route. Supported methods: POST. in laravel 8

hello i have problem ith my filter table fitur, how to solved this problem The PUT method is not supported for this route. Supported methods: POST. ?

this is the button in my blade view

<!-- Modal Add Tanggal -->
    <div class="modal fade" id="addTanggal" tabindex="-1" role="dialog" aria-labelledby="addTanggalLabel" aria-hidden="true">
       <div class="modal-dialog modal-dialog-centered" role="document">
          <div class="modal-content ">
                <div class="modal-header">
                  <h5 class="modal-title mb-0" id="addTanggalLabel">Pilih Periode Transaksi</h5>
                </div>
              <div class="modal-body">
                 <!-- Card body -->
                <form role="form" action="{{ route('rekap.penjualan.filter') }}" method="POST">
                  @csrf
                  @method('put')
                  <div class="row input-daterange datepicker align-items-center">
                    <div class="col">
                      <div class="form-group">
                        <label class="form-control-label">Awal Tanggal</label>
                        <input class="form-control" id="created_at" name="awal" placeholder="Awal Tanggal" type="text" value="">
                      </div>
                    </div>
                    <div class="col">
                      <div class="form-group">
                        <label class="form-control-label">Akhir Tanggal</label>
                        <input class="form-control" name="akhir" placeholder="Akhir Tanggal" type="text" value="">
                      </div>
                    </div>
                  </div>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
              <button type="submit" class="btn btn-primary">Lihat Data</button>
            </div>
            </form>
         </div>
       </div>
    </div>

this is the route

//rekapan transaksi Penjualan
    Route::get('rekapan/penjualan', 'AppHttpControllersTransaksiController@rekappenjualan')->name('rekap.penjualan');
    Route::post('rekapan/penjualan/filter', 'AppHttpControllersTransaksiController@rekapfilter')->name('rekap.penjualan.filter');
    Route::delete('rekapan/penjualan/delete/{id}', 'AppHttpControllersTransaksiController@delete')->name('rekap.penjualan.delete')->middleware('admin');
    Route::get('rekapan/penjualan/detail', 'AppHttpControllersTransaksiController@detailrekappenjualan')->name('rekap.penjualan.detail');

this is the controller

public function rekapfilter(Request $request)
    {
        $start = $request->awal;
        $end = $request->akhir;
        $transaksis = Transaksi::select('kode_transaksi', 'bayar', 'kembali', 'created_at', DB::raw('sum(total_barang) as total_beli'), 'subtotal', 'user_id', 'daftar_pelanggan_id')
        ->groupBy('kode_transaksi', 'bayar', 'kembali', 'created_at', 'subtotal', 'user_id', 'daftar_pelanggan_id')
        ->whereBetween(DB::raw('DATE(created_at)'), array($start, $end))->get();
        return view('pages.rekapan.penjualan', compact('transaksis'));
    }
question from:https://stackoverflow.com/questions/65879965/the-put-method-is-not-supported-for-this-route-supported-methods-post-in-lara

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try removing @method('put') in you blade template,

Or change this

Route::post('rekapan/penjualan/filter', 'AppHttpControllersTransaksiController@rekapfilter')->name('rekap.penjualan.filter');

Onto this

Route::put('rekapan/penjualan/filter', 'AppHttpControllersTransaksiController@rekapfilter')->name('rekap.penjualan.filter');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...