Please I have a health management system and trying to get data from the database using foreach. The return value is one array result instead of two. Kindly go through my code. I need assistance to display all results.
Controller.php
$result = \DB::table('patient_results')
->select('*')
->whereIn('test', $arraylistTable)
->where('patient_id', $id)
->where('specimen_id', $specimen_id)
->get();
$testValue = $result->pluck('test'); //return values [ "KMS", "MLS"]
foreach($testValue as $clinical_data) {
return $Testdata = \DB::table('tests')
->select('*')
->where('test_name', $clinical_data)
->get();
// returns data for only "KMS" Instead of both. There exist a data for both "KMS", "MLS". How do I display them
}