When someone moves an item you have to adjust all the items between that item and where it was moved to. So for example lets say you have 4 items where they have sort values:
a: 1
b: 2
c: 3
d: 4
When a user moves "d" to the first position you need to get all the items between the current and destination position (inclusive of the destination) and then increment their display_order. So a PHP side solution would look like this:
$myModel->where('display_order', '=', '4')->first();
$result = $myModel->where('display_order', '<', '4')->where('display_order', '>=', '1')->get();
foreach($result as $ModelObject)
{
$ModelObject->display_order++;
$ModelObject->save();
}
$myModel->display_order = 1;
$myModel->save();
If reordering is done frequently, this isn't the most optimized way to handle it since it's making N number of queries where N is the number of elements being shifted. If it's not a common use case, it's probably fine to keep it like that, but in a case where this is a common task I'd do a custom query something like this, where it's all handled by the DB with a single query:
UPDATE my_table SET display_order =
CASE
WHEN display_order = 4 THEN 1
ELSE display_order + 1
END
WHERE display_order BETWEEN 1 AND 4;