public function update($id, $request) { $oldDocument = Document::findOrFail($id); $document = new Document(); $document->number_document = $oldDocument->number_document; $document->description = $oldDocument->description; $document->expiration = $oldDocument->expiration; $document->estatus = $oldDocument->estatus; $document->responsable_id = $oldDocument->responsable_id; $document->user_id = $oldDocument->user_id; $document->save(); $newDocument = Document::where('id', $document->id)->update(['number_document' => $request->number_document, 'description' => $request->description, 'expiration' => $request->expiration, 'estatus' => $request->estatus, 'responsable_id' => $request->responsable_id, 'user_id' => $request->user()->id]); }