sergionc
6 months ago
561
8
Laravel

detect changes before updating

Posted 6 months ago by sergionc

I want to detect changes before updating the data. I have read that isDirty can be used, but I cannot understand how to apply it.

public function update(Request $request, $id)
{
    $request->validate([
        'junta_id' => 'required|numeric',
        'socio_id' => 'required|numeric',
        'ahorro' => 'required|numeric',
        'estado' => 'required|numeric',
    ]);

    Ahorroga::findOrFail($id)->update($request->all());
    toast('Ahorro Garantia Editado','success');
    return redirect('ahorroga');
}

Please sign in or create an account to participate in this conversation.