-1

I tried to edit the data form but the submit button doesn't work like it doesn't have a function. In that form I also added 1 more form which was wrapped in a modal code of view: code of view

code of controller:

public function update(Request $request)
{
    $items = Arsip::where('field_id', Auth::user()->employee->field_id)->get();

    $request->validate([
        'indikator'=>'required',
        ]);

    $i = $request->indikator;
    
    foreach($i as $row) {
        $i = indicator::find($row['id']); 
        $i->arsip_id = $row['arsip_id']; 
        $i->nama_indikator = $row['nama_indikator'];
        $i->nilai_indikator = $row['nilai_indikator']; 
        $i->save(); 
    }
    
    return view('admin.approve.index', compact('items'))->with('success', 'update data successfully.');
}
salman
  • 27
  • 7

1 Answers1

1

Don't use images in questions

You're not very clear on what is or isn't working. It feels like your form action isn't correct. $items, seeing your code snippet` is a collection and not a single model, which would mean the route wouldn't be correct.

I would suggest using named arguments when building a route: route('arsip.update', ['id' => $item->id])

Also, you're nesting a form inside a form. This is not allowed within HTML, and there is no good reason for wanting to do this. I see that this is a delete button. You can hide a form somewhere else and use javascript or a button (outside a form) with a form attribute to submit the form. See this thread's answers for this approach.

Yinci
  • 1,637
  • 1
  • 3
  • 14