I am trying to get all of the records in modal Roleplay
order by the payslips_collected ASC
(ascending).
Ascending is meant to start at the lowest value and go up. I am not getting that... here is my result of a table I made.
+----+------------------+--------+-------------+-----------------+-----------------+--------------+-----------+
| ID | Username | Shifts | Completed | Registered | Website Login | Client Login | Last Seen |
+----+------------------+--------+-------------+-----------------+-----------------+--------------+-----------+
| 1 | Danny Fure | 29 | 1 year ago | 43 minutes ago | 43 minutes ago | 1 second ago | |
| 2 | James Mack | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 3 | Peter Barlow | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 4 | Adam Chapman | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 5 | Danny Burrows | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 6 | Kieran Root | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 8 | Ashton David | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 9 | Someone Special | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 10 | Kelly Clark | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
| 11 | Abbie Grove | 0 | 1 year ago | 1 second ago | 2 days ago | 1 second ago | |
+----+------------------+--------+-------------+-----------------+-----------------+--------------+-----------+
I'm sorry its a bit messed up, it didn't format correctly. But anyway, the main issue is its showing in DESC
order, (descending) showing the highest before the lowest.
Can anyone tell me why its doing this?
Raw Query:
select * from `users` where exists (select * from `srp_user_statistics` where `users`.`id` = `srp_user_statistics`.`user_id` order by `payslips_collected` asc)
Code:
$players = Player::whereHas('roleplay', function ($query) use($orderType) {
$query->orderBy('payslips_collected', $orderType);
});