To attach other records inside a block, it is possible to use the browser
field.
browser
field:File:
views/twill/blocks/products.blade.php
1@twillBlockTitle('Products')2 3<x-twill::browser4 route-prefix="shop"5 module-name="products"6 name="products"7 label="Products"8 :max="10"9/>
browser_route_prefixes
array in the configuration in addition to routePrefix
in the form field declaration:1'block_editor' => [2 ...3 'browser_route_prefixes' => [4 'products' => 'shop',5 ],6 ...7],
getRelated
helper to retrieve the selected items. Example in a blade template:File:
views/site/blocks/blockWithBrowser.blade.php
1@php2 $selected_items = $block->getRelated('browserFieldName');3@endphp