i want to get each id's total count from another table named assign job. i saved user data into my users table and i add 3 jobs into assign job table with user id.
but now i want to get total added jobs from assign job table where user ids in my users table at once.
I wrote this function
$assignjob = DB::table('users')
->join('assign_jobs', 'users.user_id', '=', 'assign_jobs.user_id')
->get()
->count();
but this shows me total count in my assign job table. but i want to get different count for each user ids.
i want to assign different color rows with this assign job total count values.
can any one help me.
User Table:
|---------------------|------------------|
| user_id | name |
|---------------------|------------------|
| 123 | john |
|---------------------|------------------|
| 234 | peter |
|---------------------|------------------|
assign job table:
|---------------------|------------------|
| id | user_id |
|---------------------|------------------|
| 1 | 123 |
|---------------------|------------------|
| 2 | 123 |
|---------------------|------------------|
| 3 | 234 |
|---------------------|------------------|
| 4 | 234 |
|---------------------|------------------|