app/Http/Controllers/HomePageController.php
private function getBlockModule(Tree $tree, int $block_id): ModuleBlockInterface
    {
        $active_blocks = $this->module_service->findByComponent(ModuleBlockInterface::class, $tree, Auth::user());

        $module_name = DB::table('block')
            ->where('block_id', '=', $block_id)
            ->value('module_name');

        $block = $active_blocks->first(static function (ModuleInterface $module) use ($module_name): bool {
            return $module->name() === $module_name;
        });

        if ($block === null) {
            throw new NotFoundHttpException('Block not found');
        }

        return $block;
    }
private function getBlockModule(Tree $tree, int $block_id): ModuleBlockInterface
    {
        $active_blocks = $this->module_service->findByComponent(ModuleBlockInterface::class, $tree, Auth::user());

        $module_name = DB::table('block')
            ->where('block_id', '=', $block_id)
            ->value('module_name');

        $block = $active_blocks->first(static function (ModuleInterface $module) use ($module_name): bool {
            return $module->name() === $module_name;
        });

        if ($block === null) {
            throw new NotFoundHttpException('Block not found');
        }

        return $block;
    }
private function getBlockModule ( Tree $ tree , int $ block_id ) : ModuleBlockInterface { $ active_blocks = $ this -> module_service -> findByComponent ( ModuleBlockInterface :: class , $ tree , Auth :: user ( ) ) ; $ module_name = DB :: table ( 'block' ) -> where ( 'block_id' , '=' , $ block_id ) -> value ( 'module_name' ) ; $ block = $ active_blocks -> first ( static function ( ModuleInterface $ module ) use ( $ module_name ) : bool { return $ module -> name ( ) === $ module_name ; } ) ; if ( $ block === null ) { throw new NotFoundHttpException ( 'Block not found' ) ; } return $ block ; }
Get a specific block.

@param Tree $tree
@param int  $block_id

@return ModuleBlockInterface
@throws NotFoundHttpException
Get a specific block .