/** * @param int $id_passos * @param array $fields */ public function updateReferenceRows($id_passos, $fields = []) { $referenceSteps = new ReferenceSteps(); $referenceSteps->find($id_passos)->delete(); $reference = new Reference(); $reference->newSave($fields, $id_passos); }
/** * @param array $request * @param int $id_passos */ public function newSave($request, $id_passos) { if (count($request) > 0) { foreach ($request as $value) { $reference = new Reference(); $pieces = explode('|', $value); $reference->identificador = $pieces[0]; $reference->descricao = $pieces[1]; $reference->save(); $reference->id_referencia; $steps = new ReferenceSteps(); $steps->id_referencia = $reference->id_referencia; $steps->id_passos = $id_passos; $steps->save(); } } }
/** * @param int $id_passos * @param int $id_fluxo */ public function deleteAll($id_passos, $id_fluxo) { $passos = $this->find($id_passos); if ($passos) { $complementary = new \Modules\Api\Models\ComplementarySteps(); if ($rows = $complementary->find($id_passos)) { $rows->delete(); } $business = new \Modules\Api\Models\BusinessSteps(); if ($rows = $business->find($id_passos)) { $rows->delete(); } $reference = new \Modules\Api\Models\ReferenceSteps(); if ($rows = $reference->find($id_passos)) { $rows->delete(); } $passos->delete(); $flow = new Flow(); if ($rows = $flow->find($id_fluxo)) { $rows->delete(); } } }