User table
depart_id | user_role
5 | 1
4,2 | 2
5,2 | 2
1,5 | 1
I want to fetch all user with user_role=1 and depart_id=5 and depart_id=1
How to achieve using active record(or usual query)?
My code is
$user_depart = array(5,1);
$user_role = 1;
$data = DB::table('tbl_users')
->where('user_role', $user_role)
->whereIn('department_id',$user_depart)
->get();