I want to get results from Laravel by putting the results from the query into another query in foreach.
$first = DB::connection('store')
->table('entire_store')
->select('name', 'code', 'category', 'direct')
->where('open', 'Y')
->get();
The first query takes the information of the points and processes them into an array.
Match the information of the branches with the workplace in the employee table.
I want to save the workplace information of the employees together.
$temp = array();
$i =0;
foreach($first as $key => $item){
$temp[$i]['name'] = $item->name;
$temp[$i]['code'] = $item->code;
$temp[$i]['category'] = $item->category;
$temp[$i]['direct'] = $item→direct;
$second = DB::connection('store')
->table('entire_employer')
->SELECT('mgr_no','mgr_id', 'status')
->where('store',$item->code)->get();
//I tried.
foreach($second as $key2 => $item2){
$temp[$i]['mgr_id'] = $item2->mgr_id;
}
$i++;
}
I want to store the values from this query in temp_array.
I get an error if I try to save the value of the second query and print the value of temp_array ().
Is there anything more I need to do to check temp_array ()?