我有一個Session::get('employee_leave_tag');
,它包含payroll_leave_employee_id
,因爲data
不僅是我使用的一個foreach
循環。但是我有一個錯誤的foreach提供LARAVEL爲foreach()循環提供的無效參數
無效的參數()
有人可以幫助我什麼原因爲什麼我收到這個錯誤?謝謝。
public function get_session_leave_tagv2()
{
$employee = [0 => 0];
if(Session::has('employee_leave_tag'))
{
$employee = Session::get('employee_leave_tag');
}
$empdata = array();
foreach($employee as $emp)
{
$employee_id = Tbl_payroll_leave_employeev2::select('payroll_employee_id')
->join('tbl_payroll_leave_schedulev2','tbl_payroll_leave_employee_v2.payroll_leave_employee_id','=','tbl_payroll_leave_schedulev2.payroll_leave_employee_id')
->where('tbl_payroll_leave_schedulev2.payroll_leave_employee_id',$emp)
->distinct()
->get();
if(count($employee_id) == 0)
{
$empa = Tbl_payroll_employee_basic::join('tbl_payroll_leave_employee_v2','tbl_payroll_leave_employee_v2.payroll_employee_id','=','tbl_payroll_employee_basic.payroll_employee_id')->whereIn('tbl_payroll_leave_employee_v2.payroll_leave_employee_id',$emp)->get();
array_push($empdata,$empa);
}
else
{
$empb = Tbl_payroll_leave_schedulev2::getallemployeeleavedata($employee_id)->get();
array_push($empdata,$empb);
}
}
$data['new_record'] = $empdata;
return json_encode($data);
}
請將$ employee數組的輸出粘貼到您的問題中。 –