/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Department $department) { if (!Auth::user()->can('create-department')) { abort(403, 'You do not have permission to update a department'); } if (!$department->user_id != Auth::user()->id && !Auth::user()->can('administrate-department')) { //Is not the user who made it, or the site admin abort(401, "This user can not edit department ({$id})"); } $department->secureFill(Request::all()); if (!$department->save()) { abort(403, $department->errors); } return $department; }