Preview:
public function ImageOrderUpdate (Request $request, $prop, $photo) {

//The photo to edit 
$Photos_Edit = Images::where('property_id', $prop->id)->where('id', $photo)->firstorfail();

$OldPosition = $Photos_Edit->order;     // Old position
$NewPosition = $request->photoorder;    // New position

// Moving down where the fall between positions
if($NewPosition > $OldPosition) {
    Images::where('order','<', $NewPosition)->where('order','>', $OldPosition)->decrement('order');
} 
else {
    Images::where('order','>', $NewPosition)->where('order','<', $OldPosition)->increment('order');
}

// Update the image sort position
$Photos_Edit->order = $NewPosition;

return back();
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter