Here is the sample of my database structure:
id | name | role | login_status |
-----------------------------------------------
1 mark user 1
2 john lawyer 0
3 david user 0
4 erik lawyer 0
What I want is to order them in such a way that the users with the lawyer
role will be on the top of the list followed by the users with the value of 1
in the login_status
column.
I used orderBy('login_status','desc')
for the login_status column but i am having a hard time with the condition of the role
column.
expected output:
- john
- erik
- mark
- david
Any help would be appreciated. Thanks.