Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. public function reorderDepartments($id)
  2.     {
  3.       //runs on 'pilot/department/{id}/staffMembers/reorder'
  4.       //runs when user changes the order via drag and drop of the staff members in the departments
  5.       //updates the position of that staff member within this department.
  6.  
  7.         //$departmentID = $id;
  8.         $ids = request()->input('ids');
  9.  
  10.         foreach ($ids as $position => $departmentID) {
  11.             $department = Department::find($departmentID);
  12.  
  13.             $department->position = $position;
  14.  
  15.             $department->save();
  16.         }
  17.  
  18.         return $ids;
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement