type === 'categorical') { if (empty($row[$attr->slug])) $row[$attr->slug] = null; else { $foreign = NilaiAtribut::firstWhere( 'name', 'like', "%{$row[$attr->slug]}%" ); $row[$attr->slug] = $foreign->id; } } $rows[$attr->slug] = $row[$attr->slug]; } $rows['status'] = array_search( //array_search dengan teknik case insensitive strtolower(trim($row['hasil'])), array_map('strtolower', ProbabLabel::$label) ); return new TestingData($rows); } public function rules(): array { $rules['nama'] = ['bail', 'required', 'string']; foreach (Atribut::get() as $attr) { if ($attr->type === 'categorical') $rules[$attr->slug] = 'string'; else $rules[$attr->slug] = 'numeric'; } $rules['hasil'] = 'required'; return $rules; } }