Essentially u want to reindex orders of categories that have their 'order' greater than the modified category order AFTER modification and have their 'order' less than modified category pre-modification and vice versa depending whether you are increasing or decreasing the order. So like...:
public function modifyCategoryOrder(Category $category, int $newOrder){
$currentOrder = $category->order;
//reorder
if ($currentOrder < $newOrder) {
Category::whereBetween('order',[$currentOrder + 1, $newOrder])->decrement('order');
}
elseif ($currentOrder > $newOrder) {
Category::whereBetween('order', [$newOrder, $currentOrder - 1])->increment('order');
}
//update
$category->order=$newOrder;
$category->save();
}