app/Http/Controllers/HomePageController.php
public function userPageUpdate(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
    {
        $defaults = (bool) $request->get('defaults');

        if ($defaults) {
            $main_blocks = $this->userBlocks(-1, 'main')->all();
            $side_blocks = $this->userBlocks(-1, 'side')->all();
        } else {
            $main_blocks = (array) $request->get('main');
            $side_blocks = (array) $request->get('side');
        }

        $this->updateUserBlocks($user->id(), $main_blocks, $side_blocks);

        return redirect(route('user-page', ['ged' => $tree->name()]));
    }
public function userPageUpdate(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
    {
        $defaults = (bool) $request->get('defaults');

        if ($defaults) {
            $main_blocks = $this->userBlocks(-1, 'main')->all();
            $side_blocks = $this->userBlocks(-1, 'side')->all();
        } else {
            $main_blocks = (array) $request->get('main');
            $side_blocks = (array) $request->get('side');
        }

        $this->updateUserBlocks($user->id(), $main_blocks, $side_blocks);

        return redirect(route('user-page', ['ged' => $tree->name()]));
    }
public function userPageUpdate ( ServerRequestInterface $ request , Tree $ tree , UserInterface $ user ) : ResponseInterface { $ defaults = ( bool ) $ request -> get ( 'defaults' ) ; if ( $ defaults ) { $ main_blocks = $ this -> userBlocks ( - 1 , 'main' ) -> all ( ) ; $ side_blocks = $ this -> userBlocks ( - 1 , 'side' ) -> all ( ) ; } else { $ main_blocks = ( array ) $ request -> get ( 'main' ) ; $ side_blocks = ( array ) $ request -> get ( 'side' ) ; } $ this -> updateUserBlocks ( $ user -> id ( ) , $ main_blocks , $ side_blocks ) ; return redirect ( route ( 'user-page' , [ 'ged' => $ tree -> name ( ) ] ) ) ; }
Save the updted blocks on a user's page.

@param ServerRequestInterface $request
@param Tree                   $tree
@param UserInterface          $user

@return ResponseInterface
Save the updted blocks on a user s page .