How to foreach data and update data in loop using adonisjs I wannt to do something like this
in php I do this
$emp = Employee::all()
foreach($emp as $data) {
$emp_store = Store::where('emp_id', $emp->id);
$emp_store->name = $emp_name;
$emp->save()
}
but after I change into adonisjs How can I do something like this in Controller . Now I try to do
const emp = await Employee.all();
for(var val of emp) {
// I want to update data using each emp id
console.log(val)
}
after I try to do I got an error said emp is not iterable