Home  >  Q&A  >  body text

Parameter 1 passed to Illuminate\Database\Grammar::parameterize() must be of array type, given the string, in

foreach ($request->perbaikan_laporan as $key => $value) {

Perbaikan_laporan::create([
            "jadwal_sidang_id" => $request->input("jadwal_sidang_id"),
            "mahasiswa_id" => $request->input("mahasiswa_id"),
            "dosen_id" => $request->input("dosen_id"),
            "perbaikan_laporan" => $request->input("perbaikan_laporan")[$key],
        ]);
    }

P粉366946380P粉366946380284 days ago555

reply all(1)I'll reply

  • P粉106715703

    P粉1067157032023-12-15 09:11:23

    First, you can call request data as follows, the problem is that you first define the input as a string, but when it has been converted to a string you want to use it to get the key.

    Perbaikan_laporan::create([
            "jadwal_sidang_id" => $request->jadwal_sidang_id,
            "mahasiswa_id" => $request->mahasiswa_id,
            "dosen_id" => $request->dosen_id,
            "perbaikan_laporan" => $request->perbaikan_laporan[$key],
        ]);

    reply
    0
  • Cancelreply