Ejemplo n.º 1
0
 public function updateAvatar()
 {
     return $this->wrapCommonExceptions(function () {
         $imageStoreCommand = UserUpdateAvatarCommand::hydrateFromInput();
         $imageId = $this->adapter->dispatchCommand($imageStoreCommand);
         $updateAvatarCommand = new UserUpdateAvatarCommand($imageId);
         $this->adapter->dispatchCommand($updateAvatarCommand);
         return $this->respondSuccess(['entity_id' => $imageId], 201);
     });
 }
 public function handle(UserUpdateAvatarCommand $command)
 {
     $user = User::find($command->getAuthState()->actingUserId);
     $user->profile_image_id = $command->image;
     $user->save();
 }