|
@@ -112,6 +112,25 @@ class UserController extends Controller
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function updateMyProfile(Request $request): JsonResponse
|
|
|
|
|
+ {
|
|
|
|
|
+ $data = $request->validate([
|
|
|
|
|
+ 'name' => 'sometimes|string|max:255',
|
|
|
|
|
+ 'cpf' => 'sometimes|string|max:20',
|
|
|
|
|
+ 'email' => 'sometimes|email|max:255',
|
|
|
|
|
+ 'position_id' => 'sometimes|nullable|integer|exists:positions,id',
|
|
|
|
|
+ 'sector_id' => 'sometimes|nullable|integer|exists:sectors,id',
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ $user = Auth::user();
|
|
|
|
|
+ $user->update($data);
|
|
|
|
|
+
|
|
|
|
|
+ return $this->successResponse(
|
|
|
|
|
+ payload: new UserResource($user->fresh()),
|
|
|
|
|
+ message: __("messages.updated"),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function setOnLeave(int $id): JsonResponse
|
|
public function setOnLeave(int $id): JsonResponse
|
|
|
{
|
|
{
|
|
|
$item = $this->service->setOnLeave($id, Auth::id());
|
|
$item = $this->service->setOnLeave($id, Auth::id());
|