/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['name' => 'required|string']);
     $duplicate = Position::whereNotIn('id', [$request->id])->where('name', $request->name)->where('department_id', $request->department_id)->where('project_id', $request->project_id)->first();
     if ($duplicate) {
         return response()->json(true);
     }
     $position = Position::where('id', $id)->first();
     $position->name = $request->name;
     // $position->department_id = $request->department_id;
     // $position->project_id = $request->project_id;
     $position->save();
     return $position;
 }