id; $this->validatePlanRow($formularium_item_data); $drug = Drug::where('code', $formularium_item_data['item_code'])->first(); if (empty($drug)) { throw new ImportRowException(__('formularium.DRUG_CODE_NOT_FOUND'), 0, null, $row); } $formulariumItem = $formularium->items()->create([ 'item_id' => $drug->id, ]); return $formulariumItem; } catch (\Exception $e) { throw $e; } } }