I have this array as Laravel Collection :
"data": [
{
"id": 863368,
"reference": "Ref 1",
"status": 1
},
{
"id": 863391,
"reference": "Ref 2",
"status": 2
},
{
"id": 863390,
"reference": "Ref 3",
"status": 2
},
{
"id": 863396,
"reference": "Ref 4",
"status": 3
}
];
And I need to sort it by status
, not by asc
or desc
, but the records with status 2
should be first on the list, then status 1
then status 3
.
I can't figure out how to achive this, thank you in advance.