How do i get the last/latest data of each specific user_id.
Submission table
id | user_id | status | created_at | updated_at |
---|---|---|---|---|
1 | 3 | redo | somedatetime | somedatetime => dont want this |
2 | 3 | redo | somedatetime | somedatetime |
3 | 4 | redo | somedatetime | somedatetime |
4 | 5 | redo | somedatetime | somedatetime |
ID 2 is not a redundancy. I'm keeping track of the records. I need to grab id 2,3,4. I've tried using
Submission::where('status','redo')->distinct('user_id')->get();
but it returns all the value
UPDATE
For reference purpose here is the real structure of the table
as you can see user_id 78 has 2 redos which is 89 and 90. Im trying to get the latest/last one which is 90.