@use('App\Models\Company', 'Company') @use('Illuminate\Support\Arr', 'Arr') {{-- onlyTopLevel / excludeId power the parent-company picker: the first disables sub-companies (they can't themselves become parents), the second hides the company being edited (so it can't be selected as its own parent). Both are read as data-* attributes by the js-data-ajax in snipeit.js and forwarded to the /api/v1/companies/selectlist endpoint. The 'id' in the props here is the select2 id override ID. Defaults to $selectId. Modal links pass a distinct id when the trigger page already renders a company picker with the same name (which would collide on the id and confuse select2, leading to a broken select2 on the page if another "new" button is clicked.) The form's submitted field name stays $name either way.--}} {{-- Auto-hides the "New" button when rendered inside an AJAX modal. See x-input.company-select for the pattern. --}} @aware(['submitToSelect2' => false]) @props([ 'label', 'name', 'selected' => null, 'required' => false, 'multiple' => false, 'hideNewButton' => false, 'onlyTopLevel' => false, 'excludeId' => null, 'id' => null, 'help_text' => null, ]) @php $selectId = $id ?? $name.'_select'; $hideNewButton = $hideNewButton || $submitToSelect2; @endphp