app/Http/Controllers/HomePageController.php
public function userPage(UserInterface $user): ResponseInterface
    {
        $has_blocks = DB::table('block')
            ->where('user_id', '=', $user->id())
            ->exists();

        if (!$has_blocks) {
            $this->checkDefaultUserBlocksExist();

            // Copy the defaults
            (new Builder(DB::connection()))->from('block')->insertUsing(
                ['user_id', 'location', 'block_order', 'module_name'],
                static function (Builder $query) use ($user): void {
                    $query
                        ->select([DB::raw($user->id()), 'location', 'block_order', 'module_name'])
                        ->from('block')
                        ->where('user_id', '=', -1);
                }
            );
        }

        return $this->viewResponse('user-page', [
            'main_blocks' => $this->userBlocks($user->id(), 'main'),
            'side_blocks' => $this->userBlocks($user->id(), 'side'),
            'title'       => I18N::translate('My page'),
        ]);
    }
public function userPage(UserInterface $user): ResponseInterface
    {
        $has_blocks = DB::table('block')
            ->where('user_id', '=', $user->id())
            ->exists();

        if (!$has_blocks) {
            $this->checkDefaultUserBlocksExist();

            // Copy the defaults
            (new Builder(DB::connection()))->from('block')->insertUsing(
                ['user_id', 'location', 'block_order', 'module_name'],
                static function (Builder $query) use ($user): void {
                    $query
                        ->select([DB::raw($user->id()), 'location', 'block_order', 'module_name'])
                        ->from('block')
                        ->where('user_id', '=', -1);
                }
            );
        }

        return $this->viewResponse('user-page', [
            'main_blocks' => $this->userBlocks($user->id(), 'main'),
            'side_blocks' => $this->userBlocks($user->id(), 'side'),
            'title'       => I18N::translate('My page'),
        ]);
    }
public function userPage ( UserInterface $ user ) : ResponseInterface { $ has_blocks = DB :: table ( 'block' ) -> where ( 'user_id' , '=' , $ user -> id ( ) ) -> exists ( ) ; if ( ! $ has_blocks ) { $ this -> checkDefaultUserBlocksExist ( ) ; // Copy the defaults ( new Builder ( DB :: connection ( ) ) ) -> from ( 'block' ) -> insertUsing ( [ 'user_id' , 'location' , 'block_order' , 'module_name' ] , static function ( Builder $ query ) use ( $ user ) : void { $ query -> select ( [ DB :: raw ( $ user -> id ( ) ) , 'location' , 'block_order' , 'module_name' ] ) -> from ( 'block' ) -> where ( 'user_id' , '=' , - 1 ) ; } ) ; } return $ this -> viewResponse ( 'user-page' , [ 'main_blocks' => $ this -> userBlocks ( $ user -> id ( ) , 'main' ) , 'side_blocks' => $ this -> userBlocks ( $ user -> id ( ) , 'side' ) , 'title' => I18N :: translate ( 'My page' ) , ] ) ; }
Show a users's page.

@param UserInterface $user

@return ResponseInterface
Show a users s page .