In my Laravel 5.8, I have this query:
use DB;
$published_goalss = DB::table('hr_employees e')
->join('hr_employees em','em.employee_code','=','e.line_manager_id')
->join('hr_departments d','e.department_id','=','d.id')
->join('hr_employees eh','eh.employee_code','=','d.dept_head')
->join('hr_employees eb','eb.employee_code','=','d.hr_business_partner_id')
->join('appraisal_goals ag','ag.company_id','=','e.company_id')
->select(
'e.employee_code as staff_id',
DB::raw('CONCAT(e.first_name, " ", e.last_name) AS full_name'),
DB::raw('CONCAT(hr_employees.first_name, " ", hr_employees.last_name) AS full_name'),
DB::raw('IF(hr_employees.gender_code = 0, "Female", "Male") AS gender'),
'hr_employee.email as official_email',
DB::raw('CONCAT(eh.first_name, " ", eh.last_name) AS hod_name'),
DB::raw('CONCAT(eb.first_name, " ", eb.last_name) AS hrbp_name'),
DB::raw('(CASE WHEN ag.is_approved = 3 THEN "Approved" WHEN ag.is_approved = 2 THEN "Not Approved" WHEN ag.is_approved = 1 THEN "Awaiting Approval" ELSE "Draft" END) AS goal_status')
)
->where('e.employee_code', $publishedgoals)
->where('e.company_id', $userCompany)
->where('e.hr_status', 0)
->get();
When I ran it, I got this error:
Base table or view not found: 1146 Table 'myapp.hr_employees e' doesn't exist
But the table exists.
I am using XAMPP
How do I resolve this?