noblemfd
3 months ago
559
7
Laravel

Resolving Object of class stdClass could not be converted to string

Posted 3 months ago by noblemfd

When I run this code:

   public function manager_employee_list()
   {
       $userCompany = Auth::user()->company_id;
       $userEmployee = Auth::user()->employee_id;
       $identities = DB::table('appraisal_identity')->select('id')->where('company_id', $userCompany)->where('is_current', 1)->first();
    
       $linemanager = DB::table('hr_employees')->select('line_manager_id')->where('id', $userEmployee)->first();
       $linemanageremployee = DB::table('hr_employees')->select('id')->where('line_manager_id', $linemanager->line_manager_id)->get();  
       $goals = AppraisalGoal::where('employee_id', $linemanageremployee)->where('appraisal_identity_id', 
       return view('appraisal.appraisal_goals.manager_employee_list')->with('goals', $goals);        
}

I got this error:

Object of class stdClass could not be converted to string

When I did:

dd($linemanageremployee);

I got:

Illuminate\Support\Collection {#880 ▼
  #items: array:3 [▼
    0 => {#2312 ▼
  +"id": 2
}
1 => {#2326 ▼
  +"id": 3
}
2 => {#2313 ▼
  +"id": 6
    }
  ]
}

How do I resolve it?

Thank you.

Please sign in or create an account to participate in this conversation.