ldc-agis/resources/views/bo/partials/inputs/pivot-belongsToMany.blade.php
2023-12-19 15:09:12 +00:00

33 lines
1.4 KiB
PHP

{{--
VARIABLE || COMMENT || TYPE || REQUIRED || DEFAULT
$id || The id of the input tag. || string || REQUIRED ||
$name || The name of the input tag. || string || REQUIRED ||
$helper || The helper of the input. || string || REQUIRED ||
$placeholder || The placeholder of the input. || string || REQUIRED ||
$itemsList || Collection of available models. || Collection || REQUIRED ||
$itemLimit || Array of min and max limits. || array<integer> || OPTIONNAL || [0, null]
$model || The model we're creating/editing || Model class || OPTIONNAL || null
--}}
@if(!empty($label))
<label for="{{ $id }}" class="col-form-label">
<b>{{ $label }} {{ $required ? '*' : '' }}</b>
</label>
@endif
@php
$data = [
'name' => $name,
'value' => old($name, $model->{$name} ?? []) ?? [],
'placeholder' => $placeholder,
'itemsList' => $itemsList,
'itemLimit' => $itemLimit ?? null,
'errors' => $errors->getBag('default')->getMessages() ?? [],
];
@endphp
<div class="belongs-to-many-dropdown" data-json='@json($data)'></div>
@include('modules.input-error', [
'inputName' => $name,
'helperId' => "{$id}Help",
'helper' => $helper,
])